Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAlbert Evangelista
27,689 Pointswon't compile, I got this instead Error:java: javacTask: source release 1.8 requires target release 1.8
won't compile, I got this instead Error:java: javacTask: source release 1.8 requires target release 1.8
any settings I might need to change in intelliJ. I'm using 1.8 sdk already.
7 Answers
Daniel Maia
6,228 Pointshave you tried to change, sourceCompatibility = 1.5 to sourceCompatibility = 1.8
Albert Evangelista
27,689 PointsI haven't tried it but it looks good. Yeah it works.
john hannes
Courses Plus Student 346 PointsThank you! I was going crazy here.
But why does it work in the video but not here?
Paul Yorde
10,497 PointsI am getting this result when I run main: STARTED @1175ms org.eclipse.jetty.server.Server@387f17e4.
It will sit for a while and then show that message again. Any ideas?
I ran lsof -i:4567
and according to this its listening, I guess:
java 89378 origin 51u IPv6 0x26bbf3e24d065a41 0t0 TCP *:tram (LISTEN)
and after a while the messages says: [org.eclipse.jetty.server.session.HashSessionManager@6e14b6c0Timer] DEBUG org.eclipse.jetty.server.session - Scavenging sessions at 1468615775992
I've also tried setting the port to 9090 before the call to get in .Main:port(9090);
The results is error 404 not found. Also the result for 4567.
I've also tried awaitInitialization();
also before the call to get. Then it just sets a waits with out any messages. So, it seems the server is not initializing. What does this mean???
Should I have a web.xml file?
George Siaskov
1,292 PointsCould somebody say, where to change this in IntelliJ? :(
My Preferences -> Java Complier Screen - https://yadi.sk/i/_wLChxARtgFqj
Albert Evangelista
27,689 PointsMy guess is that the bytecode target is set somewhere else in the video. I did this before I tried the "sourceCompatibility = 1.8" solution and it worked too. It is in File > Settings > Build, Execution, Deployment > Compiler > Java compiler , you will see below the per - module there is/are modules, you select one and to the right of that are your options.. I don't know why it defaults to 1.5. I'm testing the Project bytecode option as I write this.
Ninoslav Bozilovic
5,033 Pointsyou just need to change sourceCompatibility to proper sdk version in your build.gradle file
Albert Evangelista
27,689 PointsI've a new question. Its about the 'maven repository' being 'unindexed' popup message. I'm thinking about clicking Disable... I clicked the update repository first but it takes a long time. It still pops up, the message. I'm using IntelliJ 2016.1.
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 PointsIf it's still relevant... I had the same problem with 'unindexed' popup message, but after updating it disappeared. Also in Gradle Workshop by Craig second video he disregarded this warning. So I guess it's not so important.
farhaday m
7,998 Pointsmy soursecCompatibility = 1.5 is underlined in gray and the lightbulb says "Argument is not used". anyone know how to fix this? im also having the issue "won't compile, I got this instead Error:java: javacTask: source release 1.8 requires target release 1.8"
Ninoslav Bozilovic
5,033 Pointstry to change sourceCompatibility=1.8
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 PointsHi, everyone
Just wanted to mention that it seems exist another solution to this problem, provided by Michael Walters here
Quoting his answer
The error is: Error:java: javacTask: source release 1.8 requires target release 1.8
When you leave 'Create separate module per source set' checked, if you open Preferences > Build, Execution, Deployment > Compiler > Java Compiler, the version per module is set to 1.6 or lower. That causes the error.
But, if you don't check it, IntelliJ doesn't set versions per module, and the release error doesn't happen.
It is similar for solution of Albert Evangelista , but using the way above it looks like one does not even need to go to
Preferences > Build, Execution, Deployment > Compiler > Java Compiler
line, to change anything
Albert Evangelista
27,689 Pointsthis is what is on the build.gradle
group 'com.teamtreehouse.courses' version '1.0-SNAPSHOT'
apply plugin: 'java'
sourceCompatibility = 1.5
repositories { mavenCentral() }
dependencies { compile 'com.sparkjava:spark-core:2.3' testCompile group: 'junit', name: 'junit', version: '4.11' }
this is in Main.java
package com.teamtreehouse.courses;
import static spark.Spark.get;
public class Main { public static void main(String[] args) { get("/hello", (req, res) -> "Hello World"); } }
Caleb Kleveter
Treehouse Moderator 37,862 PointsCaleb Kleveter
Treehouse Moderator 37,862 PointsCan you post your code?