Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. The Java platform is set to "JDK 1.6" in the same dialog. Which compiler is used by NetBeans? Why doesn't NetBeans use the JDK compiler?

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

like image 711
deamon Avatar asked Jul 29 '10 16:07

deamon


People also ask

What compiler does NetBeans use?

The Netbeans C/C module minimally requires a C compiler, C compiler, make utility, and gdb debugger. See Configuring the NetBeans IDE for C/C++/Fortran for instructions on installing and configuring the required compilers and tools.

Can NetBeans compile Java?

On the main NetBeans menu, choose Build → Build Main Project. The output window shows a successful compilation. If the compilation isn't successful, make changes to the code in the editor window, and try compiling again.

Which JDK is compatible with NetBeans 14?

The Apache NetBeans 14 binary releases require JDK 11+, and officially support running on JDK 11 and JDK 17.


2 Answers

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.

Unlike Eclipse (which uses its own Eclipse Java Compiler), Netbeans actually uses the internal API of javac for compiling, syntax highlighting, and error detection. 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.

sources:

  • http://www.theserverside.com/tip/Digging-into-the-NetBeans-Java-Editor
  • http://wiki.netbeans.org/FaqCompileOnSave
like image 160
Aleksandr Dubinsky Avatar answered Oct 01 '22 01:10

Aleksandr Dubinsky


Why doesn't NetBeans use the JDK compiler?

Quite simply because Sun's javac is intended to be used for batch-based compilation from the command line of definitively valid files. 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.).

Different tools for different requirements.

like image 37
Andrzej Doyle Avatar answered Oct 01 '22 01:10

Andrzej Doyle