ant and java 8 - “major version 52 is newer than 5

2019-02-08 08:03发布

问题:

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

回答1:

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.



回答2:

This error usually comes when there is difference in the JDK version.Please check classpath, java -version and JAVA_HOME set in the environment variable.



回答3:

Make sure to add JAVA_HOME in the Classpath variables: Window->Java->Build Path->Classpath variables point to "path/to/jdk"



标签: java eclipse ant