Producing "bundled" JREs for other platforms?
Claes Redestad
claes.redestad at oracle.com
Sun Jul 24 19:26:36 UTC 2016
Hi,
(disclaimer: I haven't verified this actually works. There might be
bugs and lack of test coverage to fully support this)
the jmods shipped with the JDK are designed to be self-contained, e.g.,
$JDK/jmods/java.base.jmod contain bin/java, shared libraries and the
JVM itself; all resources in the resulting image (binaries etc) are derived
not from the JDK running jlink, but from the jmods on which the jlink tool
operates.
That means it should be straightforward to produce a runnable image
from any platform-specific JDK in a cross-platform manner by specifying
--modulepath correctly.
Try downloading, say, the latest OS X build to foo and try this (using
your native JDK):
$JAVA_HOME/bin/jlink --modulepath foo/jmods --addmods java.se.ee
--output bar
bar should now contain an image natively runnable on OS X.
Thanks!
/Claes
On 07/24/2016 08:01 PM, org.openjdk at io7m.com wrote:
> Hello.
>
> I understand that in JDK 9, the "jlink" tool is able to produce a
> run-time image that contains the application's modules and a bundled
> JRE (which is itself stripped down to only those modules required to
> actually run the application). Unless I've misunderstood, this seems to
> imply that there'd be a small set of platform-specific native
> executables capable of executing the bundled runtime (I'm not sure
> what else it could mean).
>
> I can't seem to find anything conclusive online, so I have to ask: Am I
> required to build images on each of the platforms I support? Currently,
> I distribute code which I expect to run on Windows, Linux, OS X,
> Solaris, and FreeBSD, on a number of architectures for each. I only ever
> actually *build* code on Linux AMD64, which saves me from having one
> trusted build setup for each combination of operating system and
> architecture (I can run the tests on any untrusted system).
>
> If the tool is capable of producing runtimes for other platforms: Who
> defines for which platforms the tool is capable of doing so?
>
> Is there more documentation on jlink available? The only notes I can
> find are JEP-282 and bug JDK-8080531. I'm using what appears to be
> early access build 128 and the jlink program included with that seems
> to be somewhat light on command line arguments that could suggest that
> it can do any of the above.
>
> Regards,
> Mark
More information about the jigsaw-dev
mailing list