JEP proposed to target JDK 11: 330: Launch Single-File Source-Code Programs

Mario Torre neugens at
Tue May 22 12:11:57 UTC 2018

On Mon, May 21, 2018 at 5:41 PM, Brian Goetz <brian.goetz at> wrote:

> Shebang support is an additional feature provided for deploying script-like
> programs -- which is necessarily _at the end of their development phase_.

I respectfully disagree, Roman's point that beginning a Java file #!
makes it not Java is sound. Also, we can't control how people will
write their code, so "_at the end of their development phase_" may be
a very wild assumption that most people may or may not follow. I
suspect in fact that it may be quite the opposite, as it's a much
faster way to write python styled tools and applications in Java,
people my start using it expensively, especially given the rise of all
the current features like var and lambdas etc...

It seems rather odd that we are allowing a feature that enables
writing invalid Java code that a specific implementation of Java can
run but that the JLS specifically forbid. It would be most sensible to
amend the specification so that the first two bytes can be 0x23 0x21
to identify a java file that is also a script..

Volker's suggestion may clarify the issues but it won't bypass them, I
would rather prefer not to have the confusion in the first place.


Mario Torre
Associate Manager, Software Engineering
Red Hat GmbH <>
9704 A60C B4BE A8B8 0F30  9205 5D7E 4952 3F65 7898

More information about the jdk-dev mailing list