Re: Java 3D in eclipse Mac OSX not functioning
Posted by
jmaasing on
Feb 06, 2015; 7:02pm
URL: https://forum.jogamp.org/Java-3D-in-eclipse-Mac-OSX-not-functioning-tp4033010p4034011.html
I just tried this for my toy-application "nightfly" - substitute for you app name where applicable.
Create the application directory structure:
nightfly.app/Contents/MacOSCreate this file:
nightfly.app/Contents/Info.plistwith this content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>CFBundleName</key>
<string>Nightfly</string>
<key>CFBundleExecutable</key>
<string>nightfly</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
</dict>
</plist>Then create this script file:
nightfly.app/Contents/MacOS/nightflyMake it executable (e.g. chmod +x nightfly)
This is the script content:
#!/bin/sh
PRG="$0"
if [ -x "/usr/libexec/java_home" ]; then
jdkhome=`/usr/libexec/java_home`
fi
if [ ! -x "${jdkhome}/bin/java" ] ; then
echo "Cannot find java." >&2
exit 2
fi
progdir=`dirname "$PRG"`
APPNAME=`basename "$PRG"`
echo "progdir $progdir, appname: $APPNAME"
cd $progdir && ${jdkhome}/bin/java -jar nightfly-1.0-SNAPSHOT.jarAs you can guess the executable jar is in
nightfly.app/Contents/MacOSThe executable jar has a manifest classpath pointing to lib/jogl......jar and all that jazz, the lib directory is beside the executable jar.
You should be able to use a console to run "nightfly.app/Contents/MacOS/nightfly"
if that works try:
"open nightfly.app"
If that works you should be able to double click to start it it as any OSX application

If you want application icons and such you should look at the docuemntation for Info.plist in the Apples developer documentation. But then again you might be better off looking at for example JavaFX-launchers, or how jMonkeyEngine creates launcher, or look at PackR (it's a libgdx-project), launch4j or similar projects.