Help Us Improve. Please let us know if you were asked any question in your interview.

More Questions

ERROR - javac: invalid target release: 1.8 Usage: javac use -help for a list of possible options while building project using Maven

Error

Failure executing javac, but could not parse the error:
javac: invalid target release: 1.8
Usage: javac <options> <source files>

use -help for a list of possible options

while building project using Maven.

Error Type


Build Time


Cause

Maven is looking for Java 8 to build the project but it's not able to figure where it's installed.

Very likely your JAVA_HOME is pointing to some other Java Directory ( and not Java 8 )

Resolution

Check the Directory configured within JAVA_HOME by using command 

echo $JAVA_HOME

and make sure that its the path for Java 8 directory

If not,

Following this to update your JAVA_HOME - http://stackoverflow.com/questions/24641536/how-to-set-java-home-in-linux-for-all-users

If you would like downgrade to some previous Java version which has been correctly set up within JAVA_HOME, add the following entries within your pom file 

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <source>1.6</source>
            <target>1.6</target>
        </configuration>

</plugin>

This will inform Maven that we would like to build the project with Java 6 and hence it will pick Java 6 from the directory configured within JAVA_HOME.


Stay updated with Java posts in your email.

Enter your email address:


Delivered by FeedBurner
Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner
comments powered by Disqus




×

Would like to try our new Java Interview Questions Search Tool.

There are more than 1000 questions with practice tests. It's updated daily and It's Awesome.


×

Would like to try our new Java Practice Test tool.

There are more than 100 questions currently and expanding quickly. It's updated daily and It's Awesome.