JEL 477 Issue
Jaikiran Pai
jai.forums2013 at gmail.com
Tue Jul 30 15:43:34 UTC 2024
> import module java.base;
>
> main() {
>
> println("Moose");
>
>}
It appears that you are missing a "void" return type before the main()
method name. As noted in the JEP-477, it should be:
import module java.base;
void main() {
println("Moose");
}
-Jaikiran
On 30/07/24 9:05 pm, omniprof at gmail.com wrote:
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jdk-dev/attachments/20240730/ff93407e/attachment.htm>
More information about the jdk-dev
mailing list