Note that there are some explanatory texts on larger screens.

plurals
  1. POcompiling and running java8/jdk8 code in netbeans - Uncompilable source code
    text
    copied!<p>After playing with preview of <a href="http://jdk8.java.net/lambda/" rel="nofollow">JDK 1.8</a> in notepad and compiling files from command line, I thought I would try with netbeans and see what happens.</p> <p>I have successfully added JDK 1.8 and changed the following settings:</p> <blockquote> <p>properties -> libraries -> java platform: <strong>JDK 1.8</strong> </p> <p>properties -> sources -> Source/Binary format: <strong>JDK 8</strong></p> </blockquote> <p>When I <code>Clean and build</code> the project from netbeans, it builds successfully. And suggests to execute project with following command:</p> <blockquote> <p>javac 1.8.0-ea</p> <p>To run this application from the command line without Ant, try:</p> <p><strong>C:\Program Files\Java\jdk1.8.0/bin/java -jar "C:\Java8\JavaBacon\dist\JavaBacon.jar"</strong></p> </blockquote> <p>and it runs just fine from command line!</p> <p>But when I try to <code>Run</code> the project, I get following exception:</p> <pre><code>Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: &lt;any&gt; </code></pre> <p>It can build, but can't run?? </p> <p>My current workaround for this, is just to put the Java8 code in separate <code>Java Class Library</code> 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 <code>-&gt;</code> to <code>- &gt;</code>, but it builds! ( very nice :D )</p> <p>But what is the reason for not being able to <code>Run</code> the project?</p> <h2>UPDATE:</h2> <p>The exception goes away when disabling <code>Compile On Save</code> setting under:</p> <blockquote> <p>Properties > Build > Compiling</p> </blockquote> <p><a href="http://netbeans.org/bugzilla/show_bug.cgi?id=199293" rel="nofollow">http://netbeans.org/bugzilla/show_bug.cgi?id=199293</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload