Where do modules go in jlink images?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Where do modules go in jlink images?

Nicolai Parlog
 Hi!

Another question about jlink (guess what chapter I'm working on ;) ).
I've tried to find out where jlink puts the content of the jmods
folder, but hit a wall.

I created a full runtime image with jlink and diffed the file trees
(including disk usage), but all that got me was that my image doesn't
contain bin/jmc, jmods, lib/misssioncontrol, lib/src.zip, and
lib/plugin-legacy.jar - all of that is expected, but where are the
class files from the jmod archives?

Now I wonder, whether these are just ornamental - does lib/modules
contain all the bytecode? I'm confused.

 so long ... Nicolai



--

PGP Key:
    http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509

Web:
    http://codefx.org
        a blog about software development
    https://www.sitepoint.com/java
        high-quality Java/JVM content
    http://do-foss.de
        Free and Open Source Software for the City of Dortmund

Twitter:
    https://twitter.com/nipafx
Reply | Threaded
Open this post in threaded view
|

Re: Where do modules go in jlink images?

forax
All classes are merged in the file named 'modules' and the native libraries are extracted from the jmods and put in the lib folder, because jlink create an image for a specific architecture/OS.

cheers,
Rémi

----- Mail original -----
> De: "Nicolai Parlog" <[hidden email]>
> À: "jigsaw-dev" <[hidden email]>
> Envoyé: Dimanche 7 Janvier 2018 13:57:51
> Objet: Where do modules go in jlink images?

> Hi!
>
> Another question about jlink (guess what chapter I'm working on ;) ).
> I've tried to find out where jlink puts the content of the jmods
> folder, but hit a wall.
>
> I created a full runtime image with jlink and diffed the file trees
> (including disk usage), but all that got me was that my image doesn't
> contain bin/jmc, jmods, lib/misssioncontrol, lib/src.zip, and
> lib/plugin-legacy.jar - all of that is expected, but where are the
> class files from the jmod archives?
>
> Now I wonder, whether these are just ornamental - does lib/modules
> contain all the bytecode? I'm confused.
>
> so long ... Nicolai
>
>
>
> --
>
> PGP Key:
>    http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509
>
> Web:
>    http://codefx.org
>        a blog about software development
>    https://www.sitepoint.com/java
>        high-quality Java/JVM content
>    http://do-foss.de
>        Free and Open Source Software for the City of Dortmund
>
> Twitter:
>     https://twitter.com/nipafx
Reply | Threaded
Open this post in threaded view
|

Re: Where do modules go in jlink images?

Nicolai Parlog
 Hi Remi,

but the exact same thing happens when the JDK is linked with jlink,
right? I just now see that the native binaries from the jmod archives
are also present in lib/.

So does that really mean that the jmods folder plays no role for the
running JVM? What is it there for?

 so long ... Nicolai



On 07.01.2018 14:15, Remi Forax wrote:

> All classes are merged in the file named 'modules' and the native
> libraries are extracted from the jmods and put in the lib folder,
> because jlink create an image for a specific architecture/OS.
>
> cheers, Rémi
>
> ----- Mail original -----
>> De: "Nicolai Parlog" <[hidden email]> À: "jigsaw-dev"
>> <[hidden email]> Envoyé: Dimanche 7 Janvier 2018
>> 13:57:51 Objet: Where do modules go in jlink images?
>
>> Hi!
>>
>> Another question about jlink (guess what chapter I'm working on
>> ;) ). I've tried to find out where jlink puts the content of the
>> jmods folder, but hit a wall.
>>
>> I created a full runtime image with jlink and diffed the file
>> trees (including disk usage), but all that got me was that my
>> image doesn't contain bin/jmc, jmods, lib/misssioncontrol,
>> lib/src.zip, and lib/plugin-legacy.jar - all of that is expected,
>> but where are the class files from the jmod archives?
>>
>> Now I wonder, whether these are just ornamental - does
>> lib/modules contain all the bytecode? I'm confused.
>>
>> so long ... Nicolai
>>
>>
>>
>> --
>>
>> PGP Key:
>> http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509
>>
>>
>>
Web:
>> http://codefx.org a blog about software development
>> https://www.sitepoint.com/java high-quality Java/JVM content
>> http://do-foss.de Free and Open Source Software for the City of
>> Dortmund
>>
>> Twitter: https://twitter.com/nipafx
>

--

PGP Key:
    http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509

Web:
    http://codefx.org
        a blog about software development
    https://www.sitepoint.com/java
        high-quality Java/JVM content
    http://do-foss.de
        Free and Open Source Software for the City of Dortmund

Twitter:
    https://twitter.com/nipafx
Reply | Threaded
Open this post in threaded view
|

Re: Where do modules go in jlink images?

forax
----- Mail original -----
> De: "Nicolai Parlog" <[hidden email]>
> À: [hidden email]
> Cc: "jigsaw-dev" <[hidden email]>
> Envoyé: Dimanche 7 Janvier 2018 14:26:08
> Objet: Re: Where do modules go in jlink images?

> Hi Remi,
>
> but the exact same thing happens when the JDK is linked with jlink,
> right? I just now see that the native binaries from the jmod archives
> are also present in lib/.
>
> So does that really mean that the jmods folder plays no role for the
> running JVM?

yes

> What is it there for?

make jlink working :)
the transformation done by jlink is not reversible.

>
> so long ... Nicolai

Rémi

>
>
>
> On 07.01.2018 14:15, Remi Forax wrote:
>> All classes are merged in the file named 'modules' and the native
>> libraries are extracted from the jmods and put in the lib folder,
>> because jlink create an image for a specific architecture/OS.
>>
>> cheers, Rémi
>>
>> ----- Mail original -----
>>> De: "Nicolai Parlog" <[hidden email]> À: "jigsaw-dev"
>>> <[hidden email]> Envoyé: Dimanche 7 Janvier 2018
>>> 13:57:51 Objet: Where do modules go in jlink images?
>>
>>> Hi!
>>>
>>> Another question about jlink (guess what chapter I'm working on
>>> ;) ). I've tried to find out where jlink puts the content of the
>>> jmods folder, but hit a wall.
>>>
>>> I created a full runtime image with jlink and diffed the file
>>> trees (including disk usage), but all that got me was that my
>>> image doesn't contain bin/jmc, jmods, lib/misssioncontrol,
>>> lib/src.zip, and lib/plugin-legacy.jar - all of that is expected,
>>> but where are the class files from the jmod archives?
>>>
>>> Now I wonder, whether these are just ornamental - does
>>> lib/modules contain all the bytecode? I'm confused.
>>>
>>> so long ... Nicolai
>>>
>>>
>>>
>>> --
>>>
>>> PGP Key:
>>> http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509
>>>
>>>
>>>
> Web:
>>> http://codefx.org a blog about software development
>>> https://www.sitepoint.com/java high-quality Java/JVM content
>>> http://do-foss.de Free and Open Source Software for the City of
>>> Dortmund
>>>
>>> Twitter: https://twitter.com/nipafx
>>
>
> --
>
> PGP Key:
>    http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509
>
> Web:
>    http://codefx.org
>        a blog about software development
>    https://www.sitepoint.com/java
>        high-quality Java/JVM content
>    http://do-foss.de
>        Free and Open Source Software for the City of Dortmund
>
> Twitter:
>     https://twitter.com/nipafx
Reply | Threaded
Open this post in threaded view
|

Re: Where do modules go in jlink images?

Nicolai Parlog
 Hi Remi.

>> So does that really mean that the jmods folder plays no role for
>> the running JVM?
>
> yes

Wow.

>
>> What is it there for?
>
> make jlink working :) the transformation done by jlink is not
> reversible.

Mind blown.

Will have to go back to a previous chapter and do some correcting...

 so long ... Nicolai



On 07.01.2018 14:38, [hidden email] wrote:

> ----- Mail original -----
>> De: "Nicolai Parlog" <[hidden email]> À: [hidden email] Cc:
>> "jigsaw-dev" <[hidden email]> Envoyé: Dimanche 7
>> Janvier 2018 14:26:08 Objet: Re: Where do modules go in jlink
>> images?
>
>> Hi Remi,
>>
>> but the exact same thing happens when the JDK is linked with
>> jlink, right? I just now see that the native binaries from the
>> jmod archives are also present in lib/.
>>
>> So does that really mean that the jmods folder plays no role for
>> the running JVM?
>
> yes
>
>> What is it there for?
>
> make jlink working :) the transformation done by jlink is not
> reversible.
>
>>
>> so long ... Nicolai
>
> Rémi
>
>>
>>
>>
>> On 07.01.2018 14:15, Remi Forax wrote:
>>> All classes are merged in the file named 'modules' and the
>>> native libraries are extracted from the jmods and put in the
>>> lib folder, because jlink create an image for a specific
>>> architecture/OS.
>>>
>>> cheers, Rémi
>>>
>>> ----- Mail original -----
>>>> De: "Nicolai Parlog" <[hidden email]> À: "jigsaw-dev"
>>>> <[hidden email]> Envoyé: Dimanche 7 Janvier
>>>> 2018 13:57:51 Objet: Where do modules go in jlink images?
>>>
>>>> Hi!
>>>>
>>>> Another question about jlink (guess what chapter I'm working
>>>> on ;) ). I've tried to find out where jlink puts the content
>>>> of the jmods folder, but hit a wall.
>>>>
>>>> I created a full runtime image with jlink and diffed the
>>>> file trees (including disk usage), but all that got me was
>>>> that my image doesn't contain bin/jmc, jmods,
>>>> lib/misssioncontrol, lib/src.zip, and lib/plugin-legacy.jar -
>>>> all of that is expected, but where are the class files from
>>>> the jmod archives?
>>>>
>>>> Now I wonder, whether these are just ornamental - does
>>>> lib/modules contain all the bytecode? I'm confused.
>>>>
>>>> so long ... Nicolai
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> PGP Key:
>>>> http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509
>>>>
>>>>
>>>>
>>
>>>>
Web:

>>>> http://codefx.org a blog about software development
>>>> https://www.sitepoint.com/java high-quality Java/JVM content
>>>> http://do-foss.de Free and Open Source Software for the City
>>>> of Dortmund
>>>>
>>>> Twitter: https://twitter.com/nipafx
>>>
>>
>> --
>>
>> PGP Key:
>> http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509
>>
>>
>>
Web:
>> http://codefx.org a blog about software development
>> https://www.sitepoint.com/java high-quality Java/JVM content
>> http://do-foss.de Free and Open Source Software for the City of
>> Dortmund
>>
>> Twitter: https://twitter.com/nipafx
>

--

PGP Key:
    http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509

Web:
    http://codefx.org
        a blog about software development
    https://www.sitepoint.com/java
        high-quality Java/JVM content
    http://do-foss.de
        Free and Open Source Software for the City of Dortmund

Twitter:
    https://twitter.com/nipafx
Reply | Threaded
Open this post in threaded view
|

Re: Where do modules go in jlink images?

Alan Bateman
In reply to this post by Nicolai Parlog
On 07/01/2018 12:57, Nicolai Parlog wrote:

>   Hi!
>
> Another question about jlink (guess what chapter I'm working on ;) ).
> I've tried to find out where jlink puts the content of the jmods
> folder, but hit a wall.
>
> I created a full runtime image with jlink and diffed the file trees
> (including disk usage), but all that got me was that my image doesn't
> contain bin/jmc, jmods, lib/misssioncontrol, lib/src.zip, and
> lib/plugin-legacy.jar - all of that is expected, but where are the
> class files from the jmod archives?
>
> Now I wonder, whether these are just ornamental - does lib/modules
> contain all the bytecode? I'm confused.
>
JEP 220 describes the layout of the run-time image and may help. Many
modules will only contain classes and resources, they will go the jimage
container (the internal "modules" file) as Rémi said. Many of the JDK
modules have launchers (the jdk.compiler module has the javac launcher
for example), native library, configuration files, legal notices, man
pages, ...  The jlink tool puts these in the locations listed in the JEP.

-Alan
Reply | Threaded
Open this post in threaded view
|

Re: Where do modules go in jlink images?

Nicolai Parlog
 Hi Alan,

my mistake was to assume that the JMOD files contain the bytecode that
the JVM is running. A look into a JRE image would have saved me from that.

 so long ... Nicolai



On 07.01.2018 18:51, Alan Bateman wrote:

> On 07/01/2018 12:57, Nicolai Parlog wrote:
>>   Hi!
>>
>> Another question about jlink (guess what chapter I'm working on ;) ).
>> I've tried to find out where jlink puts the content of the jmods
>> folder, but hit a wall.
>>
>> I created a full runtime image with jlink and diffed the file trees
>> (including disk usage), but all that got me was that my image doesn't
>> contain bin/jmc, jmods, lib/misssioncontrol, lib/src.zip, and
>> lib/plugin-legacy.jar - all of that is expected, but where are the
>> class files from the jmod archives?
>>
>> Now I wonder, whether these are just ornamental - does lib/modules
>> contain all the bytecode? I'm confused.
>>
> JEP 220 describes the layout of the run-time image and may help. Many
> modules will only contain classes and resources, they will go the jimage
> container (the internal "modules" file) as Rémi said. Many of the JDK
> modules have launchers (the jdk.compiler module has the javac launcher
> for example), native library, configuration files, legal notices, man
> pages, ...  The jlink tool puts these in the locations listed in the JEP.
>
> -Alan
>

--

PGP Key:
    http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509

Web:
    http://codefx.org
        a blog about software development
    https://www.sitepoint.com/java
        high-quality Java/JVM content
    http://do-foss.de
        Free and Open Source Software for the City of Dortmund

Twitter:
    https://twitter.com/nipafx
Reply | Threaded
Open this post in threaded view
|

Re: Where do modules go in jlink images?

Gunnar Morling
Hi Nicolai,

Funny, I was just exploring the related code the other day. If you are
interested, look for usage of
jdk.tools.jlink.internal.BasicImageWriter.MODULES_IMAGE_NAME, this will get
you to the code for writing the "modules" file.

--Gunnar


2018-01-08 21:06 GMT+01:00 Nicolai Parlog <[hidden email]>:

>  Hi Alan,
>
> my mistake was to assume that the JMOD files contain the bytecode that
> the JVM is running. A look into a JRE image would have saved me from that.
>
>  so long ... Nicolai
>
>
>
> On 07.01.2018 18:51, Alan Bateman wrote:
> > On 07/01/2018 12:57, Nicolai Parlog wrote:
> >>   Hi!
> >>
> >> Another question about jlink (guess what chapter I'm working on ;) ).
> >> I've tried to find out where jlink puts the content of the jmods
> >> folder, but hit a wall.
> >>
> >> I created a full runtime image with jlink and diffed the file trees
> >> (including disk usage), but all that got me was that my image doesn't
> >> contain bin/jmc, jmods, lib/misssioncontrol, lib/src.zip, and
> >> lib/plugin-legacy.jar - all of that is expected, but where are the
> >> class files from the jmod archives?
> >>
> >> Now I wonder, whether these are just ornamental - does lib/modules
> >> contain all the bytecode? I'm confused.
> >>
> > JEP 220 describes the layout of the run-time image and may help. Many
> > modules will only contain classes and resources, they will go the jimage
> > container (the internal "modules" file) as Rémi said. Many of the JDK
> > modules have launchers (the jdk.compiler module has the javac launcher
> > for example), native library, configuration files, legal notices, man
> > pages, ...  The jlink tool puts these in the locations listed in the JEP.
> >
> > -Alan
> >
>
> --
>
> PGP Key:
>     http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509
>
> Web:
>     http://codefx.org
>         a blog about software development
>     https://www.sitepoint.com/java
>         high-quality Java/JVM content
>     http://do-foss.de
>         Free and Open Source Software for the City of Dortmund
>
> Twitter:
>     https://twitter.com/nipafx
>