Resolved: javac: invalid target release: 1.6

javac: invalid target release: 1.6 :
Recently I ran into this while compiling some stuff through Maven. My development environment is Mac OS X(10.5), Eclipse (3.5), Maven (2.0.9), Java (1.6)
I tried some suggestions through Google but they didn’t help me. Finally resolved the isse. Follow this steps:

  • Check if JAVA_HOME is set
  • Check if PATH is set & it’s pointing to same Java version
  • Now another important thing – Run mvn –version, check if the Java version matches.
(Mac Users)If do this:
Check your CurrentJDK path defined under "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK".
That is most likely the culprit. Maven script uses this symlink value.

You are hopefully done 🙂

3 Comments

JeremyFebruary 20th, 2012 at 11:16 am

It may be two-and-a-half years after this was written, but, thanks to the vagaries of the internet, it was the first site listed on Google, and it solved my problem immediately. Many thanks.

jimJune 12th, 2012 at 7:03 am

it worked for me. . thanks 🙂

marco cabreraAugust 23rd, 2012 at 11:02 am

2012 and still working your site.. thanks

Leave a comment

Your comment

*