Compiling and running java8 / jdk8 code in netbeans - Uncompiled source code

After playing with a preview of JDK 1.8 in notepad and compiling files from the command line, I thought I would try with netbeans and see what happens.

I 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 project from netbeans, it builds successfully. And offers to complete the project with the 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 works great from the command line!

But when I try to run a Run project, I get the following exception:

 Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: <any> 

He can build, but can not work?

My current workaround for this is to simply put the Java8 code in a separate Java Class Library and call it from the main project, since it can build the library. Obviously when using java8 functions you get red squiggles, no intellisense and autoformatting changes -> to - > , but it builds! (very nice: D)

But what is the reason for the impossibility of Run project?

UPDATE:

The exception disappears when the Compile On Save parameter is disabled:

Properties> Assembly> Compilation

http://netbeans.org/bugzilla/show_bug.cgi?id=199293

+6
source share
1 answer

The exception disappears when the Compile On Save parameter is disabled:

Properties> Assembly> Compilation

Link: netbeans error database

+1
source

Source: https://habr.com/ru/post/912701/


All Articles