I'm trying to create a java-based GUI for both Mac and windows. So far, I've been able to create an executable .jar
file that runs on Windows.
The issue I'm running into is running that .jar
on Mac. When I double-click to run, it says I should use -XstartOnFirstThread
option to run the .jar
. So, I've created a shell script that simply opens it with the following line of code:
java -XstartOnFirstThread -jar myJar.jar
This runs the program well, but it's not a solution that is easily distributable. So, I'm trying to bundle the .jar into a Mac app. So far, everything I've tried results in the same error code:
LSOpenURLsWithRole() failed for the application MyApp.app with error -10810
Here's what I've tried so far:
JarBundler (link here): same issue
Java Tutorial: tried following this tutorial, but appbundler seems not to exist anymore (at least I can't find it on my mac and I can't find it on Java's website) and most of the links to other softwares that are on this page are dead.
AppBundler ant task (link here): Couldn't quite firgure out how to use this.
Eclipse OS-X App Bundler: same issue.
changing permissions on the executable JavaApplicationStub within the app: same issue
bundling the app on my own from scratch: same issue.
I'm pretty much out of ideas at this point, is there anything I am missing?
EDIT: The .jar file that I'm using was created by Eclipse's "create runnable JAR file" export option. Not sure if this makes a different or not.
I just tested this with this Mario.jar
Steps:
This is the way I used to convert a .jar (ShowTime.jar, Class ShowTime) into an .app, On MacOS Terminal:
mkdir -p package/macosx
cp ShowTime.icns package/macosx
jdk=$(/usr/libexec/java_home)
$jdk/bin/javapackager -version
$jdk/bin/javapackager -deploy -native dmg \
-srcfiles ShowTime.jar -appclass ShowTime -name ShowTime \
-outdir deploy -outfile ShowTime -v
cp deploy/bundles/ShowTime-1.0.dmg show-time-installer.dmg
ls -l
This is from where I take the example: How to Create a Mac OS X Installer for a Java Application
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With