执行此行时发生以下错误:找不到类:javac1.8

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23456831/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 23:07:05  来源:igfitidea点击:

following error occurred while executing this line: Class not found: javac1.8

javanetbeansantcompilation

提问by user3578539

I know this has been asked in other questions however. The fix was not explained enough for me. I am extremely new to java and all that comes with it. (I am Using netbeans)

我知道这已经在其他问题中被问到了。对我来说,修复程序没有得到足够的解释。我对 Java 及其附带的所有内容非常陌生。(我正在使用netbeans)

Im getting this error when running my program;

运行我的程序时出现此错误;

Updating property file: C:\Users\Sam\Documents\NetBeansProjects\Assignment1\build\built-jar.properties
C:\Users\Sam\Documents\NetBeansProjects\Assignment1\nbproject\build-impl.xml:926: The following error occurred while executing this line:
C:\Users\Sam\Documents\NetBeansProjects\Assignment1\nbproject\build-impl.xml:268: Class not found: javac1.8
BUILD FAILED (total time: 0 seconds)

I read that i need to update my ant? How do i do that? I checked the website and it's really confusing for me.

我读到我需要更新我的蚂蚁?我怎么做?我检查了网站,这对我来说真的很困惑。

I also saw somebody suggesting to add "-Dbuild.compiler=javac1.7" to bypass having to update this. Where exactly in my code would i put that? Thanks for your time and advice in advance. It's really appreciated :)

我还看到有人建议添加“-Dbuild.compiler=javac1.7”来绕过必须更新它。我会把它放在我的代码中的哪个位置?提前感谢您的时间和建议。真的很感激:)

采纳答案by Kent Shikama

In Netbeans go to Preferences -> Java -> Ant. If your on an older version of Netbeans, the Ant tab may be under Preferences -> Miscellaneous -> Ant. At the very top it should have a label saying something like "(Apache Ant(?) version 1.93 compiled on 2/14/2014)". If the version is below 1.9, then you must update it as it is not compatible with Java 8.

在 Netbeans 中,转到首选项 -> Java -> Ant。如果您使用的是较旧版本的 Netbeans,则 Ant 选项卡可能位于 Preferences -> Miscellaneous -> Ant 下。在最顶部,它应该有一个标签,上面写着“(Apache Ant(?) 1.93 版编译于 2/14/2014)”。如果版本低于 1.9,那么您必须更新它,因为它与 Java 8 不兼容。

It is most likely sufficient just to update to the latest version of Netbeans which comes with Apache Ant version 1.92. Or if you want to update the Ant version there is already a detailed stack overflow answer.

很可能仅更新到 Apache Ant 1.92 版附带的最新版本的 Netbeans 就足够了。或者,如果您想更新 Ant 版本,已经有详细的堆栈溢出答案