JEP 330

Remi Forax forax at
Thu May 31 20:36:48 UTC 2018

----- Mail original -----
> De: "Cay Horstmann" <cay.horstmann at>
> À: "compiler-dev" <compiler-dev at>
> Envoyé: Jeudi 31 Mai 2018 18:30:56
> Objet: Re: JEP 330

> Hi Rémi,
>> The JEP also said that it simplify the writing of small utility scripts  > and
>>   i think it is its major selling point.> There are a lot of
> scripts (bootstrap, build, deployment, continuous > testing scripts,
> etc) that should be written in Java instead of being > written in shell
> because Java is cross platform.
> I actually have a bunch of scripts that I wrote in Java (and then call
> from a shell script or alias). But the "single file" thing isn't as
> useful as it appears at first. Most of my scripts depend on some JAR
> (JavaMail, Commons CSV, ...).
> With a Python script, you use pip to manage those dependencies, and in
> the script you just import them. In Java, the best I can do is rely on
> Maven/Ivy.

or just put the jar near the shebang file :)

> Suppose I have a Java script that uses JavaMail and I want to give it to
> a colleague. Let's assume that the colleague knows how to fetch the
> dependencies into the Ivy cache. What would the shebang line look like?
> A classpath into ~/.ivy2??? I don't know how to do that cross platform.
> Now THAT would be a great problem to solve in the launcher.

You create a ModuleLayer (or an URLClassLoader if you are not using modules), and load the jars you want.

> Cheers,
> Cay


More information about the compiler-dev mailing list