I am trying to upgrade my ant project from java 7 to java 8.
(the project deployed in "Eclipse Kepler" with "Java™ 8 support to Eclipse Kepler SR2")
For that i downloaded ant 1.9.4 ( according this post http://wiki.eclipse.org/Ant/Java8 ) , and configure it's as my "ant home".
when i am trying to compile a got the following warning: "major version 52 is newer than 51, the highest major version supported by this compiler. [javac] It is recommended that the compiler be upgraded."
But the compiler that defined for the workspace is 1.8. (In the ant configuration it's define the compiler to be the same compiler of the work space..)
Any idea whats happened?
Thanks a lot.
Eyal
Please check that the tools.jar used by Ant is from JDK8 and not JDK7.
Window -> Preferences:
In the left pane, go to Ant -> Runtime. In the Classpath tab, check the Global Entries.
这个错误一般出现在JDK版本不同时。请检查环境变量中设置的classpath、java -version和JAVA_HOME。
确保在Classpath变量中添加JAVA_HOME:Window->Java->Build Path->Classpath variables point to "path/to/jdk"
In Ubuntu, I simply fixed it by configure javah
from jdk(either openjdk or oracle jdk works) 7 to 8:
$ javah -classpath . -d jni/ NativeSorting
./NativeSorting.class: major version 52 is newer than 51, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
$ sudo update-alternatives --config javah
There are 4 choices for the alternative javah (providing /usr/bin/javah).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-openjdk-amd64/bin/javah 1081 auto mode
* 1 /usr/lib/jvm/java-7-openjdk-amd64/bin/javah 1071 manual mode
2 /usr/lib/jvm/java-8-openjdk-amd64/bin/javah 1081 manual mode
3 /usr/lib/jvm/jdk1.7.0_80/bin/javah 1000 manual mode
4 /usr/lib/jvm/jdk1.8.0_131/bin/javah 1000 manual mode
Press <enter> to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/javah to provide /usr/bin/javah (javah) in manual mode
$ javah -classpath . -d jni/ NativeSorting
$
添加到所有其他答案中:为我解决这个问题的是删除PATH
环境变量中冗余/不同的 java 路径。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.