Fwd: JMOD, native libraries and the packaging of JavaFX
john.r.rose at oracle.com
Mon Apr 23 18:30:45 UTC 2018
This is timely. Somebody on jigsaw-dev is raising the question of
co-packaging binary resources with classfiles, in JMODs or hacky
JARs. (My preference ATM is the latter, but JMODs support this
It would be good if one of us could figure out what Mike Hearn
is requesting, and what prior tech. he is thinking of. Then we
could do the usual exercise of combining requirements into a
single design (or smaller number of designs).
Samuel, do you have a pointer to docs for any special file formats
used in your framework for managing binary code resources?
Begin forwarded message:
From: Mike Hearn <mike at plan99.net>
Subject: JMOD, native libraries and the packaging of JavaFX
Date: April 23, 2018 at 10:21:33 AM PDT
To: jigsaw-dev at openjdk.java.net
...JARs that contain
native libraries, along with hacky custom code to extract and load them,
are actually quite common. One example is Conscrypt but there are others.
An extended JAR format in which the JVM took care of loading the right
native library would be a very helpful thing to have. Whilst the task can
be tricky if you want to do it as efficiently as possible e.g. not save the
DLL / DSO to disk, a "good enough" approach can't be that hard because the
community has implemented it many times.
I'm thinking about this issue now because I quite like JavaFX and its
future is clearly as a regular Java library, albeit a big one, distributed
either via (not ideal) an SDK or (better) a set of regular libraries
published to a Maven repository.
...If the JAR format was extended in this way, it would become possible to
write a tool that given a Maven coordinate would resolve and then install
into a bin/ directory on the path a starter program with the suggested
name. This would be a nice feature to have (I am writing such a tool
already, but it'd be good to standardise the way to express a desired
I realise there isn't much time left until the Java 11 ship sails. But for
JavaFX users at least, it'd be convenient to have this small extension.
Even if the JVM isn't extended to support it in 11, a common format would
allow it to take over responsibility later.
More information about the panama-dev