Hi Ken, On Wed, 4 Jun 2025 at 21:42, Kenneth Fogel <kfo...@dawsoncollege.qc.ca.invalid> wrote: > Error: LinkageError occurred while loading main class JavaSpaghetti > java.lang.UnsupportedClassVersionError: JavaSpaghetti (class > file version 68.65535) was compiled with preview features that are > unsupported. This version of the Java Runtime only recognizes preview > features for class file version 69.65535 ... > Ant reports that the java.class.version is 69 which is to be expected using > Java 25. Also, if I run a program that does not use any JEP 512: Compact > Source Files and Instance Main Methods then it runs fine. > > What else might I be missing?
The problem suggests that the code was compiled by NetBeans' Java 24 nbjavac and not the JDK's Java 25 javac. That could be that Compile on Save is switched on as Peter suggested - I don't think we changed the default on Ant projects, but I'd recommend always switching it off, everywhere. It might also be that you need to add javac.fork=true to the project properties on Ant. I would question why you're using Ant for this? The Ant support is probably a cause of a number of issues here. Given the intentions of JEP 512, do you need a project here at all? Creating a new Java file in the Favorites window and editing / running that as a single source file seems a better way to explore this feature? You can add VM and program args as file properties. Best wishes, Neil --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org For additional commands, e-mail: dev-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists