Argh, now I just cannot help myself not to blurt this out. One of the most frustrating small knacks I have come up against lately.
At work, I need to rebuild one customer specific Java web application using JDK 1.6 to match the base product change to target 1.6.
So I login to the build machine, check out that there is JDK 1.6 installed, update the Ant build.xml with new JDK location + target and start the build...WHAT??!! I scratch my head and try editing all the related properties and build script files - trying out all combinations of parameters ...to no avail.
... compile: [echo] ============================================================ [echo] Compiling source files [javac] Compiling 12 source files to C:\projects\xxx\build\classes [javac] javac: invalid target release: 1.6 [javac] Usage: javac
Ok... Google gives me a load of links to discussions like this one on stackoverflow:Well... In our ant script we tell the exact path to the javac executable, so it cannot be that - changing the JAVA_HOME obviously has no effect in this case either.
Q: problem in ant build ... ant source and target to 1.6 en variable path to jdk 1.6 A: It might be useful for some to know that ant looks at the JAVA_HOME variable when deciding which Java version to use A: Check the used Java-version with adding following line to your target (at the beginning): ... etc
So to debug the issue I fire up a command prompt and try it manually:BOOM!! There it is - the same error message outside of Ant.
C:\>%JAVA_HOME%\bin\javac -version javac 1.6.0_21 javac: no source files Usage: javac
Hmm, now lets try on another JDK 1.6 update:...so there have been some broken JDK build(s) out there and the solution is to upgrade the JDK. Phew.
C:\>set JAVA_HOME=C:\Progra~1\Java\jdk1.6.0_45 C:\>%JAVA_HOME%\bin\javac -version javac 1.6.0_45 C:\>%JAVA_HOME%\bin\javac -target 1.6 javac: no source files Usage: javac
Luckily I get paid for this ;) ...and the Oracle JDK8 for Raspberry Pi (well, "Linux ARM v6/v7 Hard Float ABI") is still pretty awesome :D