After playing with preview of JDK 1.8 in notepad and compiling files from command line, I thought I would try with netbeans and see what happens.
I have successfully added JDK 1.8 and changed the following settings:
properties -> libraries -> java platform: JDK 1.8
properties -> sources -> Source/Binary format: JDK 8
When I Clean and build
the project from netbeans, it builds successfully. And suggests to execute project with following command:
javac 1.8.0-ea
To run this application from the command line without Ant, try:
C:\Program Files\Java\jdk1.8.0/bin/java -jar "C:\Java8\JavaBacon\dist\JavaBacon.jar"
and it runs just fine from command line!
But when I try to Run
the project, I get following exception:
Exception in thread "main" java.lang.RuntimeException:
Uncompilable source code - Erroneous tree type: <any>
It can build, but can't run??
My current workaround for this, is just to put the Java8 code in separate Java Class Library
and call it from main project, since it can build the library.
Obviously when using java8 features, you get red squiggles, lack of intellisense and autoformatting changes ->
to - >
, but it builds! ( very nice :D )
But what is the reason for not being able to Run
the project?
The exception goes away when disabling Compile On Save
setting under:
Properties > Build > Compiling
http://netbeans.org/bugzilla/show_bug.cgi?id=199293
Right click, and from the context menu select Navigate > Go to Source and you should be redirected to the appropriate position within the source of the JDK class. Alternatively, press Ctrl + Shift + B.
But you need to set JDK path as JDK 8 in the system path (like you did for JDK 9). While installing Netbeans select JDK 8 installation path as JDK for Netbeans.
You can compile and run an individual file (as opposed to a whole project) using the IDE's Compile File (F9) and Run File (Shift-F6) commands. If you use the Run Main Project command, the IDE will run the file that the IDE associates as the main class of the main project.
The Apache NetBeans 13 binary releases require JDK 11+, and officially support running on JDK 11 and JDK 17.
The exception goes away when disabling Compile On Save
setting under:
Properties > Build > Compiling
Reference: netbeans bug database
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With