Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK 10 is not bundled #56

Open
schw4rzlicht opened this issue Apr 9, 2018 · 7 comments
Open

JDK 10 is not bundled #56

schw4rzlicht opened this issue Apr 9, 2018 · 7 comments

Comments

@schw4rzlicht
Copy link

I am trying to bundle a JavaFX application for macOS using JDK 10, Gradle 4.6.0 and plugin version 2.2.1.
When bundleJRE = false, everything seems to work and I can start the app (because JDK 10 is installed locally). When set to true, the JDK doesn't seem to be bundled to the app unfortunately, so starting the app results in a JRELoadError.

The corresponding directory in the app bundle is empty:
bildschirmfoto 2018-04-09 um 17 14 41

What am I missing here?

@crotwell
Copy link
Owner

crotwell commented Apr 9, 2018

I have not tried with java10, so not sure.

Do you have jreHome set as well? If not does /usr/libexec/java_home give the correct path for java10?

This is a simple copy of the jre, so if java10 is installed in a different way from previous versions it may not work.

@schw4rzlicht
Copy link
Author

Do you have jreHome set as well?

No.

If not does /usr/libexec/java_home give the correct path for java10?

Yes, it points to /Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home:

julian$ /usr/libexec/java_home 
/Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home
julian$ cd /Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home
julian$ ls -l
total 16
-r--r--r--    1 root  wheel   158  8 Mär 03:16 README.html
drwxr-xr-x   48 root  wheel  1536  8 Mär 03:20 bin
drwxr-xr-x    7 root  wheel   224  8 Mär 03:16 conf
drwxr-xr-x   11 root  wheel   352  8 Mär 03:16 include
drwxr-xr-x  100 root  wheel  3200  8 Mär 03:16 jmods
drwxr-xr-x  101 root  wheel  3232  8 Mär 03:16 legal
drwxr-xr-x   90 root  wheel  2880  8 Mär 03:16 lib
-rw-r--r--    1 root  wheel  1653  8 Mär 03:16 release

Looks good to me on first glance.

@crotwell
Copy link
Owner

crotwell commented Apr 9, 2018

That is the difference, under previous versions of java, there was a directory called jre inside Contents/Home that contained all that was needed to run java. Obviously you do not want to include the entire jdk when all you need is the jre. Guess I will have to rethink how that works if this is how newer jdk's will be distributed.

A bit of a pain, but in the meantime if you can figure out what files you need to include, you can create a directory that is a "fake" jre and set jreHome to that. The directory should contain:
Contents/Home/jre
where you set jreHome to be the 'jre' subdirectory inside. The task will go up two levels and so copy effectively
<jreHome>/../../Contents/Home/jre/** along with <jreHome>/../../Contents/Info.plist
into the project.

Alternatively, you could set up your own gradle Sync task to put stuff in the right place and have createApp.dependsOn('myJreCopyTask').

Likely there are other issues if they really have changed the directory layout significantly. Please let me know what you find out if you do try this.

@schw4rzlicht
Copy link
Author

It looks like JDK 9 is also affected and the directory structure you mentioned was changed in that version already. According to https://docs.oracle.com/javase/9/install/installed-directory-structure-jdk-and-jre.htm, the JRE is installed in /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/.

I will have a closer look later, just wanted to report back.

@benzoid
Copy link

benzoid commented Oct 4, 2018

Hi, (obviously) this effects Java 11 too. This might now be a more urgent problem with Java 11 the now current (and LTS) release, and Java 8 on the way out.
Thanks!

@crotwell
Copy link
Owner

I've done some reading and looks like bundling the jre has changed significantly in java after8 and even more after 9 and this should probably be done with jlink as opposed to just copying a directory into the app.

@Josh-Larson
Copy link

Perhaps it could work if you copied the results from jlink into the app, and ran the correct script (bin/)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants