Eclipse javac: invalid target release = 1.6 error when trying to compile ProcessingLibs
in
Integration and Hardware
•
1 year ago
Hi, I am new to Java/Eclipse and completely banging my head against the wall here, it seems that Ant is set up always with Java version 1.5, so the libraries won't build. What can I do to force 1.6 to be used in Eclipse? This is on OSX 10.5.8.
Tried following all the advice I could find online, as follows:
1. Check that I have the 1.6 JDK, it exists apparently in in /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
2. $JAVA_HOME set to /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
3. Run /Applications/Utilities/Java Preferences, move "Java SE 6" to top of both "Java Applet Plugin" and "Java Applications" lists. Typing "javac -version" at a command prompt now says "javac 1.6.0_13". Typing "java -version" also gives:
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03-211)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-83, mixed mode)
4. Add
<echo message="Using Java version ${ant.java.version}."/> to top of build.xml file, it still says "Using Java version 1.5."
***5. As recommended on Stack Overflow
http://stackoverflow.com/questions/4956209/problem-in-ant-build-invalid-target-release , add
<javac srcdir="${src}"
destdir="${build}"
fork="yes"
executable="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/javac"/>
however I get a new error,
"<username>/Projects/Processing/Eclipse/PToolbox/${build}" does not exist or is not a directory
can anyone tell me what I should set for srcdir and destdir to get this to work? Or any other step-by-step way to get the Processing libraries to compile with Eclipse.
6. As a last resort, I tried editing /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini file, to set -Dosgi.requiredJavaVersion=1.6 (change from 1.5) and then Eclipse would not run, now says "Version 1.5.0_19 of the JVM is not suitable for this product", so I have to change back...
Any advice is much appreciated, I am extremely new to Java and Eclipse and am experiencing extreme frustrations here.... Thanks in advance!
1