JEL 477 Issue

omniprof at gmail.com omniprof at gmail.com
Tue Jul 30 15:35:58 UTC 2024


I apologize for posting what is likely a trivial question that may be
inappropriate for this list but I cannot find anywhere in my searches to
explain what is going wrong. Simply put JEP 477 does not work in the
pre-release version of Java 23 on a Windows 11 PC. There is a lot written
that all show a similar example.

 

>> Here is the program

import module java.base;

 

main() {

    println("Moose");

}

 

>> Here is the version of Java I am running

C:\dev\Onramptesting\OnRamptest\src>java --version

 

openjdk 23-ea 2024-09-17

OpenJDK Runtime Environment (build 23-ea+34-2361)

OpenJDK 64-Bit Server VM (build 23-ea+34-2361, mixed mode, sharing)

 

>> Here I run the code with all the required switches. The errors are the
same with or without Xlint

C:\dev\Onramptesting\OnRamptest\src>javac --enable-preview --source 23
-Xlint:preview Main.java

 

Main.java:1: warning: [preview] module imports are a preview feature and may
be removed in a future release.

import module java.base;

       ^

Main.java:3: error: class, interface, enum, or record expected

main() {

^

Main.java:5: error: class, interface, enum, or record expected

}

^

2 errors

1 warning

 

Note that I get the same results for -source 23 and -release 23

 

Trying single file:

java -enable-preview Main.java

does not work as well.

 

Same result using Console or PowerShell in Windows.

 

What am I doing wrong? 

 

Ken Fogel

omniprof at gmail.com <mailto:omniprof at gmail.com> 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jdk-dev/attachments/20240730/833acdd6/attachment.htm>


More information about the jdk-dev mailing list