什么是tools.jar替换? [英] what is tools.jar replacement ?
问题描述
当我尝试构建一个ant项目时,我在eclipse上收到以下错误
I have been receiving the following error on eclipse when i try to build an ant project
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files\Java\jre-10.0.2"
但是我的JAVA_HOME变量设置为 C:\ Program Files \ Java \ jdk-10 这是命令的结果 回声%JAVA_HOME% 我确实为解决这个问题做了很多尝试,但是我对日食的了解不多,
but my JAVA_HOME variable is set to C:\Program Files\Java\jdk-10 this is the result of the command echo %JAVA_HOME% i really tried a lot to solve this problem ,but i don't know much about eclipse,
我在互联网上搜索了更多内容,发现自JDK 9起,tools.jar已从JDK中删除[link] https://www.reddit.com/r/javahelp/comments/765mwr/installed_jdk_9_and_my_toolsjar_is_missing/ 现在的问题是,为什么eclipse要求使用tools.jar?什么是tools.jar替换?
i searched some more on the internet and found out that the tools.jar has been removed from the JDK since JDK 9 [link]https://www.reddit.com/r/javahelp/comments/765mwr/installed_jdk_9_and_my_toolsjar_is_missing/ the question now is why is eclipse asking for the tools.jar ,and what is tools.jar replacement ?
我将非常感谢您的帮助 非常感谢
I would really appreciate any help thank you very much
推荐答案
在Java 9和更高版本中,以前在tools.jar
中的组件已转换为模块.对于javac编译器,您需要使用java.compiler
模块.这不是简单的直接替换.
In Java 9 and later, the components that were previously in tools.jar
have been turned onto modules. For the javac compiler, you need to use the java.compiler
module. This is not a simple drop-in replacement.
如果依赖于tools.jar
的第三方应用程序(例如Ant)遇到问题,则需要将该应用程序升级到与Java 9+兼容的较新版本.
If you run into problems with a 3rd-party application (such as Ant) that depends on tools.jar
, you need to upgrade the application to a newer version that is Java 9+ compatible.
根据我对 Apache Ant网站的阅读,这意味着您需要Ant1.10.x.检查网站的下载页面以查看当前推荐的内容.
According to my reading of the Apache Ant site, that means you need Ant 1.10.x. Check the site's download page to see what is currently recommended.
这篇关于什么是tools.jar替换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!