Draft JEP: Launch Single-File Source-Code Programs

Jonathan Gibbons jonathan.gibbons at oracle.com
Fri Feb 9 18:30:29 UTC 2018

On 2/9/18 4:32 AM, Lennart Börjeson wrote:

>> 9 feb. 2018 kl. 00:18 skrev Jonathan Gibbons <jonathan.gibbons at oracle.com>:
>> This draft JEP contains a proposal to enhance the |java| launcher to
>> support running a
>> program supplied as a single file of Java source code. The program will
>> be compiled
>> and run, without the need to explicit invoke javac, or to package up a
>> jar file.
>> For more details, see:
>> http://openjdk.java.net/jeps/8192920
>> -- Jon
> Most welcome!
> One comment, though: As a linux/unix user, I'd expect the jshell executable to be the processor for jshell scripts, not the compiler ("java"). This would tie in with the established pattern of other shell script processors/repl, e.g. groovysh, or even plain bash.
> Best regards,
> /Lennart


The content of a source file supported by this feature is the source 
code for a normal Java class containing a normal "public static void 
main(String[])" method.  It is not the same as the input you might give 
to jshell, which is a combination of "snippets" of Java code and 
commands for the JShell tool, which are designed for use in an 
interactive environment.

-- Jon

More information about the jdk-dev mailing list