As a Canadian I must begin by apologizing for what there may be an obvious 
solution.

I am puzzled by the behaviour of NB when working with Java 25. I installed NB 
26 with its version of Java. I created a project that required Java 25 and 
configured NB, in netbeans.conf, to use the Java 25 EA. I also verified that 
the project properties referenced JDK-25. The NB editor does not show any 
errors or warnings. The program runs flawlessly from the CLI. Here is the code:

void main() {
    var secretNumber1 = new Random().nextInt(10) + 1;
    int guessNumber;
    do {
        guessNumber = Integer.parseInt(IO.readln("Guess a number from 1 to 10: 
"));
        if (guessNumber < secretNumber1) IO.println("Too small");
        else if(guessNumber > secretNumber1) IO.println("Too large");
    } while (secretNumber1 != guessNumber);
    IO.println("You win!");
}

But when I run it in NB I get:

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

The features I am using are no longer preview and so -enable-preview is not 
required. Even if I leave it, the code does not run.

Am I to assume that the only way to make this work on Java 25 is to compile the 
NB source using Java 25?

No, that is not it because when I just compiled from source with Java 25 the 
results were the same. Somewhere it is blocking Java 25. 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?

Ken

Reply via email to