简体   繁体   English

NetBeans使用哪种java编译器?

[英]Which java compiler is used by NetBeans?

If I tell NetBeans (6.9) to compile on save, NetBeans warns me the compiled classes are not identical to classes compiled with JDK's compiler. 如果我告诉NetBeans(6.9)在save上编译,NetBeans警告我编译的类与用JDK编译器编译的类不同。 The Java platform is set to "JDK 1.6" in the same dialog. Java平台在同一对话框中设置为“JDK 1.6”。 Which compiler is used by NetBeans? NetBeans使用哪种编译器? Why doesn't NetBeans use the JDK compiler? 为什么NetBeans不使用JDK编译器?

alt text http://img814.imageshack.us/img814/3449/compileonsave.png alt text http://img814.imageshack.us/img814/3449/compileonsave.png

Like Eclipse, Netbeans does not use standard javac so that it can offer incremental compilation and compilation of classes containing methods that have syntax errors. 与Eclipse一样,Netbeans不使用标准的javac因此它可以提供包含语法错误的方法的类的增量编译和编译。

Unlike Eclipse (which uses its own Eclipse Java Compiler), Netbeans actually uses the internal API of javac for compiling, syntax highlighting, and error detection. 与Eclipse(使用自己的Eclipse Java编译器)不同,Netbeans实际上使用javac的内部API进行编译,语法突出显示和错误检测。 This is a nice advantage, in that Netbeans is able to handle all of the latest Java language features and faithfully reproduces any nuances or bugs of javac's behavior. 这是一个很好的优势,因为Netbeans能够处理所有最新的Java语言功能,并忠实地再现javac行为的任何细微差别或错误。

sources: 来源:

Why doesn't NetBeans use the JDK compiler? 为什么NetBeans不使用JDK编译器?

Quite simply because Sun's javac is intended to be used for batch-based compilation from the command line of definitively valid files. 很简单,因为Sun的javac旨在用于从最终有效文件的命令行进行基于批处理的编译。 Whereas NetBeans (and other IDEs) do incremental compilation as you type, and quite often have additional features such as creating classes for invalid files (so you can run methodA if methodB has a syntax error in, etc.). 而NetBeans的(和其他IDE)做增量编译为您键入,而且经常有额外的功能,例如创建为无效文件类(这样你就可以运行methodA如果methodB在等语法错误)。

Different tools for different requirements. 针对不同要求的不同工具。

检查Java平台管理器:工具 - > Java平台

很久以来问了问题,但我想你想要的是: http//wiki.netbeans.org/FaqCompileOnSave

在Program Files \\ NetBeans 6.8 \\ etc中有一个netbeans_jdkhome值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM