Draft JEP: Launch Single-File Source-Code Programs

Jonathan Gibbons jonathan.gibbons at oracle.com
Mon Feb 12 23:07:30 UTC 2018



On 2/12/18 1:37 PM, David Lloyd wrote:
> On Thu, Feb 8, 2018 at 5:18 PM, Jonathan Gibbons
> <jonathan.gibbons at oracle.com> wrote:
>> 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
> It was pointed out on IRC that it would seem almost more fitting to
> fit this in to javax.script as a ScriptEngine, using the existing
> jrunscript as a launcher instead of java.  Weird but also not weird at
> all!
>
> It would be worth explaining why this shouldn't be the case in the JEP
> (if indeed it shouldn't be the case).

Good question.

I note that jrunscript is listed as "Note: This tool isexperimental and 
unsupported.".
Also, it does not appear to be shebang-friendly, since it would require a
number of options to configure, and shebang lines should generally contain
at most a single option after the path for the executable.

-- Jon



More information about the jdk-dev mailing list