Java 11 has been released.
The official version of Java 11 has been released, and support for the Oracle JDK will be charged from this version. Expectations for free long-term support provided by OpenJDK are low at this time https://www.publickey1.jp/blog/18/java_11oracle_jdkopenjdk.html
"Execute Java code in a single file as it is" in it
JEP 330: Launch Single-File Source-Code Programs http://openjdk.java.net/jeps/330
I tried.
I tried the Windows version. ~~http://openjdk.java.net/~~ I followed the link from ~~, but ... I followed the link to the Oracle JDK and installed it. ~~ ~~ OpenJDK 11 is here (look for later). ~~
You can download it from the following. https://jdk.java.net/11
Install it for the time being and check the java version. I updated from java 8 on Windows The environment variables remained unchanged at java 8, so I manually rewrote the PATH and JAVA_HOME paths to java 11.
$ java -version
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
And a single java file
test.java
class Test {
public static void main(String[] arg) {
System.out.println("Hello World");
}
}
Run without compiling
$ java test.java
Hello World
I was able to execute it. ..
Of course you can compile and run
$ javac test.java
$ ls
Test.class test.java
$ java Test
Hello World
Obviously, When using .class files, there is no first intermediate compilation, so execution is faster.
Recommended Posts