Closed orsjb closed 6 years ago
Just tested here with bundleJRE=true and it worked, so not sure what to say. I assume you have java from installed?
What version of OSX? What version of Java?
What is the output of: /usr/libexec/java_home
Did you set jreHome?
OSX 10.12.6 I have two versions of Java installed: jdk-9.jdk, jdk1.8.0_121.jdk So java_home points to jdk-9 at the moment (I did try removing jdk-9, apparently Mac OS simply picks the most recent version, this didn't make any difference). My gradle project has source compatibility set to 1.8. I'm quite new to gradle. I'm not 100% sure which java version I'm running when I run the project from gradle. I can check. Where can I see the bundled JRE?
I've also noticed a separate issue, which may not be an issue of your builder per se (so I won't log it unless you want me to). When I run my app (with bundleJRE = false) by double clicking on it, some part of the program is not running properly. However, if I run the app by calling MyApp.app/Contents/MacOS/JavaAppLauncher from the terminal it works as expected. I need to investigate more what is failing. My first thought was that certain resources are not loading, but they seem to be. So I wonder if something to do with JavaFX graphics rendering is not behaving in the same way. I realise this is incredibly vague - that's because I don't know how to see the standard out and error when running the app, so I can't tell what is failing. Is there a log file somewhere that will show me the Java stdout and stderr?
Anyway, thanks for making such an awesome plugin. This is surely the missing ingredient to make gradle the winner Java build tool.
PS those are both Oracle Java.
Java is copied into the Contents/PlugIns directory inside the app, so for example TestApp.app/Contents/PlugIns/jdk1.8.0_51.jdk
You can try running your app from the command line with
open Test.app
which is closer to double clicking than directly running JavaAppLauncher
OK thanks. So the Java 9 JDK was being bundled. I assume this is done based on the system settings (use whichever JDK is most recent), as I don't see any setting saying to use JDK 9. When I removed JDK 9 from my /Libraries/Java/JavaVirtualMachines folder everything worked perfectly and the app had Java 8 bundled.
Thank you! Perhaps the world is just not ready for Java 9 ;-)
I'll check into the java9 issue.
You can also set jreHome
within the macAppBundle section if you want to choose a particular jre. Otherwise it uses whatever the output of /usr/libexec/java_home
is.
The createApp task works when bundleJRE = false. My program runs and loads. However, when bundleJRE = true it does not. It opens an OS X Error Dialog saying JRELoadError. I'm not sure how to start troubleshooting this.