![](/img/trans.png)
[英]major version 53 is newer than 52, the highest major version supported by this compiler. Android studio
[英]ant and java 8 - “major version 52 is newer than 51, the highest major version supported by this compiler”
我正在尝试将我的 ant 项目从 java 7 升级到 java 8。
(在“Eclipse Kepler”中部署的项目,“Java™ 8 支持 Eclipse Kepler SR2”)
为此,我下载了 ant 1.9.4(根据这篇文章http://wiki.eclipse.org/Ant/Java8 ),并将其配置为我的“蚂蚁之家”。
当我尝试编译时收到以下警告: "major version 52 is newer than 51, the highest major version supported by this compiler. [javac] It is recommended that the compiler be upgraded."
但是为工作区定义的编译器是 1.8。 (在 ant 配置中,它将编译器定义为与工作空间相同的编译器..)
知道发生了什么吗?
非常感谢。
艾尔
请检查 Ant 使用的 tools.jar 是否来自 JDK8 而不是 JDK7。
窗口 -> 首选项:
在左窗格中,转到 Ant -> Runtime。 在 Classpath 选项卡中,检查 Global Entries。
这个错误一般出现在JDK版本不同时。请检查环境变量中设置的classpath、java -version和JAVA_HOME。
确保在Classpath变量中添加JAVA_HOME:Window->Java->Build Path->Classpath variables point to "path/to/jdk"
在 Ubuntu 中,我只是通过从 jdk(openjdk 或 oracle jdk 工作)7 到 8 配置javah
来修复它:
$ 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 路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.