shebang script:
$ cat Hello
#!/usr/bin/env java --enable-preview
void main() {
println("hello");
}
$ chmod 755 Hello
$ ./Hello
Error: Could not find or load main class ..Hello
Caused by: java.lang.ClassNotFoundException: //Hello
Per JEP 330
"The --source option must also be used to specify the source version of the source code when the --enable-preview option is used."
But, the error message above is misleading. The error message may mention about --source option requirement.
$ cat Hello
#!/usr/bin/env java --enable-preview
void main() {
println("hello");
}
$ chmod 755 Hello
$ ./Hello
Error: Could not find or load main class ..Hello
Caused by: java.lang.ClassNotFoundException: //Hello
Per JEP 330
"The --source option must also be used to specify the source version of the source code when the --enable-preview option is used."
But, the error message above is misleading. The error message may mention about --source option requirement.
- links to
-
Review(master) openjdk/jdk/21910