Java 11 is coming. It was originally scheduled for Release in September, less than three months away, so stay tuned for more features to be added to it. This article is about JEP 330.

To simplify, a command compiles and runs the source code

Look at the code below.

Javac Javastack. Java // Run Java JavastackCopy the code

In our mind, to run a Java source code you must first compile it, then run it, then execute the action in two steps. In future versions of Java 11, this will be done directly with a Java command, as shown below.

java Javastack.java
Copy the code

However, it didn’t help either. Most of our development work is in the IDE, all the compilation and running process is done by the IDE, the actual use of command line compilation and running scenarios are really very rare. Of course, if you are a notepad master, please accept this feature.

On the other hand, does this mean javac is on its way out? Don’t. Because you still need the command to compile the source code, not run it directly.

Support the Shebang #! Symbols run Java programs

Shebang #! What the hell is this? This is also a related technology in JEP 330, which supports running Java programs in UNIX system scripts, as shown in the following code.

#! /path/to/java --source version
Copy the code

JEP 330 summary

Oracle JEP 330 is a feature provided only for compiling and running small Java applications, rather than using Java to become a general-purpose language. This feature was controversial at the time of review, but was eventually agreed to be included in the new Java 11 release.

Reference data: https://securityonline.info/jdk-11-will-introduce-shebang-symbol/

Spring Boot & Cloud

Scan our wechat public number, dry goods updated every day.