Merge pull request #8 from iKarith/linux
Build on Linux and macOS using reasonably current JDKs
This commit is contained in:
commit
ba85678853
|
@ -12,8 +12,6 @@ TODO.local
|
||||||
work
|
work
|
||||||
TestImage.*
|
TestImage.*
|
||||||
**/Thumbs.db
|
**/Thumbs.db
|
||||||
mac/AppleCommander.app/Contents/Resources/Java/AppleCommander.jar
|
|
||||||
mac/AppleCommander.app/Contents/Info.plist
|
|
||||||
.settings/org.eclipse.jdt.ui.prefs
|
.settings/org.eclipse.jdt.ui.prefs
|
||||||
.settings/org.eclipse.jdt.core.prefs
|
.settings/org.eclipse.jdt.core.prefs
|
||||||
build/ACBuild.properties
|
build/ACBuild.properties
|
||||||
|
|
4
TODO
4
TODO
|
@ -5,7 +5,6 @@ This is the internal list of items that need to be done.
|
||||||
-- 1.3.5 --
|
-- 1.3.5 --
|
||||||
|
|
||||||
--- FUTURE ---
|
--- FUTURE ---
|
||||||
o Automate Mac zip file build
|
|
||||||
o Add binaries to repository to simplify AC development and builds
|
o Add binaries to repository to simplify AC development and builds
|
||||||
o Create subdirectories as appropriate (ProDOS).
|
o Create subdirectories as appropriate (ProDOS).
|
||||||
o Create reusable show dialog messages (they're scattered all over right now) to clean
|
o Create reusable show dialog messages (they're scattered all over right now) to clean
|
||||||
|
@ -43,3 +42,6 @@ o Can AppleCommander read a CF card with ProDOS volumes on it? This is an IDE d
|
||||||
connected either via USB or a card reader. Requires some level of OS integration...
|
connected either via USB or a card reader. Requires some level of OS integration...
|
||||||
some form of raw disk access. There is the possibility of finding a USB-level driver
|
some form of raw disk access. There is the possibility of finding a USB-level driver
|
||||||
or of reading raw data from a disk. Unix is most likely, unsure of Windows.
|
or of reading raw data from a disk. Unix is most likely, unsure of Windows.
|
||||||
|
[iKarith: Yes, Windows can do it using a special "drive", CiderPress does it.]
|
||||||
|
o Evaluate and consider Sean Riley's appbundler fork as an alternative to jarbundler for
|
||||||
|
macOS: <https://bitbucket.org/infinitekind/appbundler>
|
||||||
|
|
|
@ -5,9 +5,15 @@
|
||||||
# ACBuild.properties. That will allow you to change locations of
|
# ACBuild.properties. That will allow you to change locations of
|
||||||
# support files for local builds.
|
# support files for local builds.
|
||||||
#
|
#
|
||||||
|
antJarPathWin=C:/Java/lib/ant1.10.1/ant.jar
|
||||||
|
antJarPathMac=/opt/local/share/java/apache-ant/lib/ant.jar
|
||||||
|
antJarPathUnix=/usr/share/java/ant.jar
|
||||||
swtJarPathWin=C:/Program Files/Eclipse 2.1.x/plugins/org.eclipse.swt.win32_2.1.3/ws/win32/swt.jar
|
swtJarPathWin=C:/Program Files/Eclipse 2.1.x/plugins/org.eclipse.swt.win32_2.1.3/ws/win32/swt.jar
|
||||||
swtJarPathMac=/Users/Shared/eclipse/plugins/org.eclipse.swt.carbon.macosx_3.3.3.v3349.jar
|
swtJarPathMac=/Users/Shared/Java/swt/swt.jar
|
||||||
|
swtJarPathUnix=/usr/share/java/swt.jar
|
||||||
junitPathWin=C:/Java/lib/junit3.8.1/junit.jar
|
junitPathWin=C:/Java/lib/junit3.8.1/junit.jar
|
||||||
junitPathMac=/Users/Shared/eclipse/plugins/org.junit_3.8.2.v200706111738/junit.jar
|
junitPathMac=/Users/Shared/eclipse/plugins/org.junit_3.8.2.v200706111738/junit.jar
|
||||||
|
junitPathUnix=/usr/share/java/junit.jar
|
||||||
keyconf=${user.home}/.secret
|
keyconf=${user.home}/.secret
|
||||||
alias=name
|
alias=name
|
||||||
|
#noGui=true
|
||||||
|
|
|
@ -2,7 +2,12 @@
|
||||||
<description>
|
<description>
|
||||||
This script builds the distribution components.
|
This script builds the distribution components.
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
|
<!-- Fix ant warning (explained: https://stackoverflow.com/questions/5103384) -->
|
||||||
|
<presetdef name="javac">
|
||||||
|
<javac includeantruntime="false" />
|
||||||
|
</presetdef>
|
||||||
|
|
||||||
<property name="work" value="work"/>
|
<property name="work" value="work"/>
|
||||||
<property name="classes" value="${work}/classes"/>
|
<property name="classes" value="${work}/classes"/>
|
||||||
<property name="dist" value="${work}/dist"/>
|
<property name="dist" value="${work}/dist"/>
|
||||||
|
@ -13,22 +18,38 @@
|
||||||
<property name="web" value="web"/>
|
<property name="web" value="web"/>
|
||||||
<property name="javadoc" value="${work}/javadoc"/>
|
<property name="javadoc" value="${work}/javadoc"/>
|
||||||
<property name="builddir" value="${basedir}/build" />
|
<property name="builddir" value="${basedir}/build" />
|
||||||
|
<property name="mac.dir" value="${basedir}/mac"/>
|
||||||
<property file="${builddir}/ACBuild.properties"/>
|
<property file="${builddir}/ACBuild.properties"/>
|
||||||
<property file="${builddir}/ACBuild-default.properties"/>
|
<property file="${builddir}/ACBuild-default.properties"/>
|
||||||
<condition property="swtjar"
|
|
||||||
value="${swtJarPathWin}"
|
<!-- If you want to add a platform, create a conditional property for it here -->
|
||||||
else="${swtJarPathMac}">
|
<condition property="isWin" value="true">
|
||||||
<os family="windows"/>
|
<os family="windows" />
|
||||||
</condition>
|
</condition>
|
||||||
<condition property="junitjar"
|
<condition property="isMac" value="true">
|
||||||
value="${junitPathWin}"
|
<and>
|
||||||
else="${junitPathMac}">
|
<os family="mac" />
|
||||||
<os family="windows"/>
|
<os family="unix" />
|
||||||
</condition>
|
</and>
|
||||||
|
</condition>
|
||||||
|
<condition property="isUnix" value="true">
|
||||||
|
<!-- macOS also provides unix, so we must explicitly exclude it here -->
|
||||||
|
<and>
|
||||||
|
<os family="unix" />
|
||||||
|
<not>
|
||||||
|
<os family="mac" />
|
||||||
|
</not>
|
||||||
|
</and>
|
||||||
|
</condition>
|
||||||
|
|
||||||
<condition property="signing-needed">
|
<condition property="signing-needed">
|
||||||
<available file="${keyconf}" property="keyconf-exists" />
|
<available file="${keyconf}" property="keyconf-exists" />
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
|
<taskdef name="jarbundler"
|
||||||
|
classname="com.ultramixer.jarbundler.JarBundler"
|
||||||
|
classpath="mac/jarbundler-core-3.3.0.jar" />
|
||||||
|
|
||||||
<target name="version" description="Get version from source.">
|
<target name="version" description="Get version from source.">
|
||||||
<property name="main.path" value="src/com/webcodepro/applecommander/ui"/>
|
<property name="main.path" value="src/com/webcodepro/applecommander/ui"/>
|
||||||
<loadfile srcfile="${main.path}/AppleCommander.java" property="acVersion">
|
<loadfile srcfile="${main.path}/AppleCommander.java" property="acVersion">
|
||||||
|
@ -45,7 +66,29 @@
|
||||||
<echo>Building version ${acVersion}...</echo>
|
<echo>Building version ${acVersion}...</echo>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="init" depends="version" description="Ensure work directory is present">
|
<target name="init-win" if="isWin">
|
||||||
|
<property name="antjar" value="${antJarPathWin}" />
|
||||||
|
<property name="swtjar" value="${swtJarPathWin}" />
|
||||||
|
<property name="juintjar" value="${junitPathWin}" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="init-mac" if="isMac">
|
||||||
|
<property name="antjar" value="${antJarPathMac}" />
|
||||||
|
<property name="swtjar" value="${swtJarPathMac}" />
|
||||||
|
<property name="juintjar" value="${junitPathMac}" />
|
||||||
|
<condition property="noMacGui" value="true">
|
||||||
|
<isset property="noGui" />
|
||||||
|
</condition>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="init-unix" if="isUnix">
|
||||||
|
<property name="antjar" value="${antJarPathUnix}" />
|
||||||
|
<property name="swtjar" value="${swtJarPathUnix}" />
|
||||||
|
<property name="juintjar" value="${junitPathUnix}" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="init" depends="version,init-win,init-mac,init-unix"
|
||||||
|
description="Ensure work directory is present">
|
||||||
<mkdir dir="${work}"/>
|
<mkdir dir="${work}"/>
|
||||||
<mkdir dir="${classes}"/>
|
<mkdir dir="${classes}"/>
|
||||||
<mkdir dir="${dist}"/>
|
<mkdir dir="${dist}"/>
|
||||||
|
@ -82,9 +125,10 @@
|
||||||
</fileset>
|
</fileset>
|
||||||
</signjar>
|
</signjar>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="executableGuiJar" depends="init" description="Build GUI executable JAR">
|
<target name="executableGuiJar" depends="init" unless="noGui"
|
||||||
<javac srcdir="${source}" destdir="${classes}" classpath="${swtjar}">
|
description="Build GUI executable JAR">
|
||||||
|
<javac srcdir="${source}" destdir="${classes}" classpath="${antjar}:${swtjar}">
|
||||||
<include name="**/*.java"/>
|
<include name="**/*.java"/>
|
||||||
<exclude name="**/*Test.java"/>
|
<exclude name="**/*Test.java"/>
|
||||||
<compilerarg value="-Xlint:unchecked"/>
|
<compilerarg value="-Xlint:unchecked"/>
|
||||||
|
@ -103,9 +147,11 @@
|
||||||
</fileset>
|
</fileset>
|
||||||
</jar>
|
</jar>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="executableCmdJar" depends="init" description="Build command-line only executable JAR">
|
<target name="executableCmdJar" depends="init"
|
||||||
<javac srcdir="${source}" destdir="${classes}" >
|
description="Build command-line only executable JAR">
|
||||||
|
<!-- SWT needs to be in classpath if executableGuiCmdJar didn't run -->
|
||||||
|
<javac srcdir="${source}" destdir="${classes}" classpath="${antjar}:${swtjar}">
|
||||||
<include name="**/*.java"/>
|
<include name="**/*.java"/>
|
||||||
<exclude name="**/*Test.java"/>
|
<exclude name="**/*Test.java"/>
|
||||||
<compilerarg value="-Xlint:unchecked"/>
|
<compilerarg value="-Xlint:unchecked"/>
|
||||||
|
@ -127,24 +173,38 @@
|
||||||
</fileset>
|
</fileset>
|
||||||
</jar>
|
</jar>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="macBundle" depends="init,jars" description="Build Mac application bundle.">
|
<target name="macBundle" depends="init,jars" if="isMac" unless="noMacGui"
|
||||||
<property name="mac.dir" value="mac"/>
|
description="Build Mac application bundle.">
|
||||||
<property name="mac.app" value="${mac.dir}/AppleCommander.app"/>
|
<property name="mac.app" value="${dist}/AppleCommander.app"/>
|
||||||
<property name="mac.Contents" value="${mac.app}/Contents"/>
|
|
||||||
<property name="mac.Java" value="${mac.Contents}/Resources/Java"/>
|
<!--
|
||||||
<copy file="${mac.dir}/Info.plist" todir="${mac.Contents}" overwrite="true">
|
NB: This seems like the only obvious way to turn ${swtjar}
|
||||||
<filterset>
|
into something we can install using jarbundler to both
|
||||||
<filter token="version" value="${acVersion}"/>
|
copy and add to classpath. If you have a better way… :)
|
||||||
</filterset>
|
-->
|
||||||
</copy>
|
<copy file="${swtjar}" tofile="${work}/swt/swt.jar" />
|
||||||
<copy file="${guijar}" tofile="${mac.Java}/AppleCommander.jar"/>
|
|
||||||
<copy file="${cmdjar}" tofile="${user.home}/bin/ac.jar"/>
|
<jarbundler dir="${dist}"
|
||||||
<zip destfile="${maczip}">
|
name="AppleCommander" version="${acVersion}"
|
||||||
<zipfileset dir="${mac.app}" prefix="AppleCommander.app"/>
|
verbose="true" showPlist="true"
|
||||||
<zipfileset dir="${mac.app}" prefix="AppleCommander.app"
|
mainclass="com.webcodepro.applecommander.ui.AppleCommander"
|
||||||
includes="Contents/MacOS/JavaApplicationStub" filemode="755"/>
|
bundleid="com.webcodepro.applecommander"
|
||||||
</zip>
|
stubfile="${mac.dir}/universalJavaApplicationStub"
|
||||||
|
icon="${mac.dir}/AppleCommander.icns"
|
||||||
|
arguments="-swt" startonmainthread="true"
|
||||||
|
jvmversion="1.6+" useJavaXKey="true" developmentregion="English"
|
||||||
|
copyright="Copyright 2002-2008 Rob Greene and John B. Matthews.">
|
||||||
|
<jarfilelist dir="${dist}" files="AppleCommander-${acVersion}.jar" />
|
||||||
|
<jarfilelist dir="${work}/swt" files="swt.jar" />
|
||||||
|
</jarbundler>
|
||||||
|
|
||||||
|
<zip destfile="${maczip}">
|
||||||
|
<zipfileset dir="${dist}/AppleCommander.app" prefix="AppleCommander-${acVersion}-mac/AppleCommander.app" />
|
||||||
|
<zipfileset dir="${dist}" prefix="AppleCommander-${acVersion}-mac/jars">
|
||||||
|
<include name="AppleCommander-${acVersion}*.jar" />
|
||||||
|
</zipfileset>
|
||||||
|
</zip>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="sourceZip" depends="init" description="Build source ZIP archive">
|
<target name="sourceZip" depends="init" description="Build source ZIP archive">
|
||||||
|
@ -205,4 +265,4 @@
|
||||||
<zipfileset dir="${javadoc}" prefix="javadoc"/>
|
<zipfileset dir="${javadoc}" prefix="javadoc"/>
|
||||||
</zip>
|
</zip>
|
||||||
</target>
|
</target>
|
||||||
</project>
|
</project>
|
||||||
|
|
Binary file not shown.
|
@ -1 +0,0 @@
|
||||||
APPL????
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,72 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
|
|
||||||
<dict>
|
|
||||||
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>English</string>
|
|
||||||
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>JavaApplicationStub</string>
|
|
||||||
|
|
||||||
<key>CFBundleGetInfoString</key>
|
|
||||||
<string>@version@: Distributed under the terms of the GNU Public license.</string>
|
|
||||||
|
|
||||||
<key>CFBundleIconFile</key>
|
|
||||||
<string>AppleCommander.icns</string>
|
|
||||||
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>AppleCommander</string>
|
|
||||||
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>APPL</string>
|
|
||||||
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>@version@</string>
|
|
||||||
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>@version@</string>
|
|
||||||
|
|
||||||
<key>Java</key>
|
|
||||||
<dict>
|
|
||||||
|
|
||||||
<key>JVMVersion</key>
|
|
||||||
<string>1.4*</string>
|
|
||||||
|
|
||||||
<key>MainClass</key>
|
|
||||||
<string>com.webcodepro.applecommander.ui.AppleCommander</string>
|
|
||||||
|
|
||||||
<key>ClassPath</key>
|
|
||||||
<string>$JAVAROOT/AppleCommander.jar:$JAVAROOT/swt.jar</string>
|
|
||||||
|
|
||||||
<key>Properties</key>
|
|
||||||
<dict>
|
|
||||||
|
|
||||||
<key>java.library.path</key>
|
|
||||||
<string>$JAVAROOT/</string>
|
|
||||||
|
|
||||||
</dict>
|
|
||||||
|
|
||||||
<key>VMOptions</key>
|
|
||||||
<string>-Xdock:name=AppleCommander</string>
|
|
||||||
|
|
||||||
<key>StartOnMainThread</key><true/>
|
|
||||||
|
|
||||||
</dict>
|
|
||||||
|
|
||||||
<key>LSHasLocalizedDisplayName</key>
|
|
||||||
<true/>
|
|
||||||
|
|
||||||
<key>NSHumanReadableCopyright</key>
|
|
||||||
<string>Copyright 2002-2008 Rob Greene and John B. Matthews.</string>
|
|
||||||
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,535 @@
|
||||||
|
#!/bin/bash
|
||||||
|
##################################################################################
|
||||||
|
# #
|
||||||
|
# universalJavaApplicationStub #
|
||||||
|
# #
|
||||||
|
# #
|
||||||
|
# A shellscript JavaApplicationStub for Java Apps on Mac OS X #
|
||||||
|
# that works with both Apple's and Oracle's plist format. #
|
||||||
|
# #
|
||||||
|
# Inspired by Ian Roberts stackoverflow answer #
|
||||||
|
# at http://stackoverflow.com/a/17546508/1128689 #
|
||||||
|
# #
|
||||||
|
# #
|
||||||
|
# @author Tobias Fischer #
|
||||||
|
# @url https://github.com/tofi86/universalJavaApplicationStub #
|
||||||
|
# @date 2017-07-28 #
|
||||||
|
# @version 2.1.0 #
|
||||||
|
# #
|
||||||
|
# #
|
||||||
|
##################################################################################
|
||||||
|
# #
|
||||||
|
# #
|
||||||
|
# The MIT License (MIT) #
|
||||||
|
# #
|
||||||
|
# Copyright (c) 2017 Tobias Fischer #
|
||||||
|
# #
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy #
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal #
|
||||||
|
# in the Software without restriction, including without limitation the rights #
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell #
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is #
|
||||||
|
# furnished to do so, subject to the following conditions: #
|
||||||
|
# #
|
||||||
|
# The above copyright notice and this permission notice shall be included in all #
|
||||||
|
# copies or substantial portions of the Software. #
|
||||||
|
# #
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE #
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, #
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #
|
||||||
|
# SOFTWARE. #
|
||||||
|
# #
|
||||||
|
##################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# resolve symlinks
|
||||||
|
############################################
|
||||||
|
|
||||||
|
PRG=$0
|
||||||
|
|
||||||
|
while [ -h "$PRG" ]; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '^.*-> \(.*\)$' 2>/dev/null`
|
||||||
|
if expr "$link" : '^/' 2> /dev/null >/dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG="`dirname "$PRG"`/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# set the directory abspath of the current shell script
|
||||||
|
PROGDIR=`dirname "$PRG"`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# set files and folders
|
||||||
|
############################################
|
||||||
|
|
||||||
|
# the absolute path of the app package
|
||||||
|
cd "$PROGDIR"/../../
|
||||||
|
AppPackageFolder=`pwd`
|
||||||
|
|
||||||
|
# the base path of the app package
|
||||||
|
cd ..
|
||||||
|
AppPackageRoot=`pwd`
|
||||||
|
|
||||||
|
# set Apple's Java folder
|
||||||
|
AppleJavaFolder="${AppPackageFolder}"/Contents/Resources/Java
|
||||||
|
|
||||||
|
# set Apple's Resources folder
|
||||||
|
AppleResourcesFolder="${AppPackageFolder}"/Contents/Resources
|
||||||
|
|
||||||
|
# set Oracle's Java folder
|
||||||
|
OracleJavaFolder="${AppPackageFolder}"/Contents/Java
|
||||||
|
|
||||||
|
# set Oracle's Resources folder
|
||||||
|
OracleResourcesFolder="${AppPackageFolder}"/Contents/Resources
|
||||||
|
|
||||||
|
# set path to Info.plist in bundle
|
||||||
|
InfoPlistFile="${AppPackageFolder}"/Contents/Info.plist
|
||||||
|
|
||||||
|
# set the default JVM Version to a null string
|
||||||
|
JVMVersion=""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# read Info.plist and extract JVM options
|
||||||
|
############################################
|
||||||
|
|
||||||
|
# read the program name from CFBundleName
|
||||||
|
CFBundleName=`/usr/libexec/PlistBuddy -c "print :CFBundleName" "${InfoPlistFile}"`
|
||||||
|
|
||||||
|
# read the icon file name
|
||||||
|
CFBundleIconFile=`/usr/libexec/PlistBuddy -c "print :CFBundleIconFile" "${InfoPlistFile}"`
|
||||||
|
|
||||||
|
|
||||||
|
# check Info.plist for Apple style Java keys -> if key :Java is present, parse in apple mode
|
||||||
|
/usr/libexec/PlistBuddy -c "print :Java" "${InfoPlistFile}" > /dev/null 2>&1
|
||||||
|
exitcode=$?
|
||||||
|
JavaKey=":Java"
|
||||||
|
|
||||||
|
# if no :Java key is present, check Info.plist for universalJavaApplication style JavaX keys -> if key :JavaX is present, parse in apple mode
|
||||||
|
if [ $exitcode -ne 0 ]; then
|
||||||
|
/usr/libexec/PlistBuddy -c "print :JavaX" "${InfoPlistFile}" > /dev/null 2>&1
|
||||||
|
exitcode=$?
|
||||||
|
JavaKey=":JavaX"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# read Info.plist in Apple style if exit code returns 0 (true, :Java key is present)
|
||||||
|
if [ $exitcode -eq 0 ]; then
|
||||||
|
|
||||||
|
# set Java and Resources folder
|
||||||
|
JavaFolder="${AppleJavaFolder}"
|
||||||
|
ResourcesFolder="${AppleResourcesFolder}"
|
||||||
|
|
||||||
|
APP_PACKAGE="${AppPackageFolder}"
|
||||||
|
JAVAROOT="${AppleJavaFolder}"
|
||||||
|
USER_HOME="$HOME"
|
||||||
|
|
||||||
|
|
||||||
|
# read the Java WorkingDirectory
|
||||||
|
JVMWorkDir=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:WorkingDirectory" "${InfoPlistFile}" 2> /dev/null | xargs`
|
||||||
|
|
||||||
|
# set Working Directory based upon Plist info
|
||||||
|
if [[ ! -z ${JVMWorkDir} ]]; then
|
||||||
|
WorkingDirectory="${JVMWorkDir}"
|
||||||
|
else
|
||||||
|
# AppPackageRoot is the standard WorkingDirectory when the script is started
|
||||||
|
WorkingDirectory="${AppPackageRoot}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# expand variables $APP_PACKAGE, $JAVAROOT, $USER_HOME
|
||||||
|
WorkingDirectory=`eval "echo ${WorkingDirectory}"`
|
||||||
|
|
||||||
|
|
||||||
|
# read the MainClass name
|
||||||
|
JVMMainClass=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:MainClass" "${InfoPlistFile}" 2> /dev/null`
|
||||||
|
|
||||||
|
# read the SplashFile name
|
||||||
|
JVMSplashFile=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:SplashFile" "${InfoPlistFile}" 2> /dev/null`
|
||||||
|
|
||||||
|
# read the JVM Options
|
||||||
|
JVMOptions=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:Properties" "${InfoPlistFile}" 2> /dev/null | grep " =" | sed 's/^ */-D/g' | tr '\n' ' ' | sed 's/ */ /g' | sed 's/ = /=/g' | xargs`
|
||||||
|
# replace occurences of $APP_ROOT with its content
|
||||||
|
JVMOptions=`eval "echo ${JVMOptions}"`
|
||||||
|
|
||||||
|
# read StartOnMainThread
|
||||||
|
JVMStartOnMainThread=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:StartOnMainThread" "${InfoPlistFile}" 2> /dev/null`
|
||||||
|
if [ "${JVMStartOnMainThread}" == "true" ]; then
|
||||||
|
JVMOptions+=" -XstartOnFirstThread"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# read the ClassPath in either Array or String style
|
||||||
|
JVMClassPath_RAW=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:ClassPath" "${InfoPlistFile}" 2> /dev/null`
|
||||||
|
if [[ $JVMClassPath_RAW == *Array* ]] ; then
|
||||||
|
JVMClassPath=.`/usr/libexec/PlistBuddy -c "print ${JavaKey}:ClassPath" "${InfoPlistFile}" 2> /dev/null | grep " " | sed 's/^ */:/g' | tr -d '\n' | xargs`
|
||||||
|
else
|
||||||
|
JVMClassPath=${JVMClassPath_RAW}
|
||||||
|
fi
|
||||||
|
# expand variables $APP_PACKAGE, $JAVAROOT, $USER_HOME
|
||||||
|
JVMClassPath=`eval "echo ${JVMClassPath}"`
|
||||||
|
|
||||||
|
# read the JVM Default Options in either Array or String style
|
||||||
|
JVMDefaultOptions_RAW=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:VMOptions" "${InfoPlistFile}" 2> /dev/null | xargs`
|
||||||
|
if [[ $JVMDefaultOptions_RAW == *Array* ]] ; then
|
||||||
|
JVMDefaultOptions=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:VMOptions" "${InfoPlistFile}" 2> /dev/null | grep " " | sed 's/^ */ /g' | tr -d '\n' | xargs`
|
||||||
|
else
|
||||||
|
JVMDefaultOptions=${JVMDefaultOptions_RAW}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# read the JVM Arguments
|
||||||
|
JVMArguments=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:Arguments" "${InfoPlistFile}" 2> /dev/null | xargs`
|
||||||
|
# replace occurences of $APP_ROOT with its content
|
||||||
|
JVMArguments=`eval "echo ${JVMArguments}"`
|
||||||
|
|
||||||
|
# read the Java version we want to find
|
||||||
|
JVMVersion=`/usr/libexec/PlistBuddy -c "print ${JavaKey}:JVMVersion" "${InfoPlistFile}" 2> /dev/null | xargs`
|
||||||
|
|
||||||
|
# read Info.plist in Oracle style
|
||||||
|
else
|
||||||
|
|
||||||
|
# set Working Directory and Java and Resources folder
|
||||||
|
JavaFolder="${OracleJavaFolder}"
|
||||||
|
ResourcesFolder="${OracleResourcesFolder}"
|
||||||
|
WorkingDirectory="${OracleJavaFolder}"
|
||||||
|
|
||||||
|
APP_ROOT="${AppPackageFolder}"
|
||||||
|
|
||||||
|
# read the MainClass name
|
||||||
|
JVMMainClass=`/usr/libexec/PlistBuddy -c "print :JVMMainClassName" "${InfoPlistFile}" 2> /dev/null`
|
||||||
|
|
||||||
|
# read the SplashFile name
|
||||||
|
JVMSplashFile=`/usr/libexec/PlistBuddy -c "print :JVMSplashFile" "${InfoPlistFile}" 2> /dev/null`
|
||||||
|
|
||||||
|
# read the JVM Options
|
||||||
|
JVMOptions=`/usr/libexec/PlistBuddy -c "print :JVMOptions" "${InfoPlistFile}" 2> /dev/null | grep " -" | tr -d '\n' | sed 's/ */ /g' | xargs`
|
||||||
|
# replace occurences of $APP_ROOT with its content
|
||||||
|
JVMOptions=`eval "echo ${JVMOptions}"`
|
||||||
|
|
||||||
|
# read the ClassPath in either Array or String style
|
||||||
|
JVMClassPath_RAW=`/usr/libexec/PlistBuddy -c "print JVMClassPath" "${InfoPlistFile}" 2> /dev/null`
|
||||||
|
if [[ $JVMClassPath_RAW == *Array* ]] ; then
|
||||||
|
JVMClassPath=.`/usr/libexec/PlistBuddy -c "print JVMClassPath" "${InfoPlistFile}" 2> /dev/null | grep " " | sed 's/^ */:/g' | tr -d '\n' | xargs`
|
||||||
|
# expand variables $APP_PACKAGE, $JAVAROOT, $USER_HOME
|
||||||
|
JVMClassPath=`eval "echo ${JVMClassPath}"`
|
||||||
|
|
||||||
|
elif [[ ! -z ${JVMClassPath_RAW} ]] ; then
|
||||||
|
JVMClassPath=${JVMClassPath_RAW}
|
||||||
|
# expand variables $APP_PACKAGE, $JAVAROOT, $USER_HOME
|
||||||
|
JVMClassPath=`eval "echo ${JVMClassPath}"`
|
||||||
|
|
||||||
|
else
|
||||||
|
#default: fallback to OracleJavaFolder
|
||||||
|
JVMClassPath="${JavaFolder}/*"
|
||||||
|
# Do NOT expand the default App.app/Contents/Java/* classpath (#42)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# read the JVM Default Options
|
||||||
|
JVMDefaultOptions=`/usr/libexec/PlistBuddy -c "print :JVMDefaultOptions" "${InfoPlistFile}" 2> /dev/null | grep -o " \-.*" | tr -d '\n' | xargs`
|
||||||
|
|
||||||
|
# read the JVM Arguments
|
||||||
|
JVMArguments=`/usr/libexec/PlistBuddy -c "print :JVMArguments" "${InfoPlistFile}" 2> /dev/null | tr -d '\n' | sed -E 's/Array \{ *(.*) *\}/\1/g' | sed 's/ */ /g' | xargs`
|
||||||
|
# replace occurences of $APP_ROOT with its content
|
||||||
|
JVMArguments=`eval "echo ${JVMArguments}"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# internationalized messages
|
||||||
|
#
|
||||||
|
############################################
|
||||||
|
|
||||||
|
LANG=`defaults read -g AppleLocale`
|
||||||
|
|
||||||
|
# French localization
|
||||||
|
if [[ $LANG == fr* ]] ; then
|
||||||
|
MSG_ERROR_LAUNCHING="Erreur au lancement de '${CFBundleName}'."
|
||||||
|
MSG_MISSING_MAINCLASS="'MainClass' n'est pas spécifié.\nL'application Java ne peut pas être lancée."
|
||||||
|
MSG_NO_SUITABLE_JAVA="La version de Java installée sur votre système ne convient pas.\nCe programme nécessite Java"
|
||||||
|
MSG_JAVA_VERSION_OR_LATER="ou ultérieur"
|
||||||
|
MSG_JAVA_VERSION_LATEST="(dernière mise à jour)"
|
||||||
|
MSG_NO_SUITABLE_JAVA_CHECK="Merci de bien vouloir installer la version de Java requise."
|
||||||
|
MSG_INSTALL_JAVA="Java doit être installé sur votre système.\nRendez-vous sur java.com et suivez les instructions d'installation..."
|
||||||
|
MSG_LATER="Plus tard"
|
||||||
|
MSG_VISIT_JAVA_DOT_COM="Visiter java.com"
|
||||||
|
|
||||||
|
# German localization
|
||||||
|
elif [[ $LANG == de* ]] ; then
|
||||||
|
MSG_ERROR_LAUNCHING="FEHLER beim Starten von '${CFBundleName}'."
|
||||||
|
MSG_MISSING_MAINCLASS="Die 'MainClass' ist nicht spezifiziert!\nDie Java-Anwendung kann nicht gestartet werden!"
|
||||||
|
MSG_NO_SUITABLE_JAVA="Es wurde keine passende Java-Version auf Ihrem System gefunden!\nDieses Programm benötigt Java"
|
||||||
|
MSG_JAVA_VERSION_OR_LATER="oder neuer"
|
||||||
|
MSG_JAVA_VERSION_LATEST="(neuste Unterversion)"
|
||||||
|
MSG_NO_SUITABLE_JAVA_CHECK="Stellen Sie sicher, dass die angeforderte Java-Version installiert ist."
|
||||||
|
MSG_INSTALL_JAVA="Auf Ihrem System muss die 'Java'-Software installiert sein.\nBesuchen Sie java.com für weitere Installationshinweise."
|
||||||
|
MSG_LATER="Später"
|
||||||
|
MSG_VISIT_JAVA_DOT_COM="java.com öffnen"
|
||||||
|
|
||||||
|
# English default localization
|
||||||
|
else
|
||||||
|
MSG_ERROR_LAUNCHING="ERROR launching '${CFBundleName}'."
|
||||||
|
MSG_MISSING_MAINCLASS="'MainClass' isn't specified!\nJava application cannot be started!"
|
||||||
|
MSG_NO_SUITABLE_JAVA="No suitable Java version found on your system!\nThis program requires Java"
|
||||||
|
MSG_JAVA_VERSION_OR_LATER="or later"
|
||||||
|
MSG_JAVA_VERSION_LATEST="(latest update)"
|
||||||
|
MSG_NO_SUITABLE_JAVA_CHECK="Make sure you install the required Java version."
|
||||||
|
MSG_INSTALL_JAVA="You need to have JAVA installed on your Mac!\nVisit java.com for installation instructions..."
|
||||||
|
MSG_LATER="Later"
|
||||||
|
MSG_VISIT_JAVA_DOT_COM="Visit java.com"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# helper function:
|
||||||
|
# extract Java version string from `java -version` command
|
||||||
|
# works for both old (1.8) and new (9) version schema
|
||||||
|
##########################################################
|
||||||
|
function extractJavaVersionString() {
|
||||||
|
# second sed command strips " and -ea from the version string
|
||||||
|
echo `"$1" -version 2>&1 | awk '/version/{print $NF}' | sed -E 's/"//g;s/-ea//g'`
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# helper function:
|
||||||
|
# extract Java major version from java version string
|
||||||
|
# - input '1.7.0_76' returns '7'
|
||||||
|
# - input '1.8.0_121' returns '8'
|
||||||
|
# - input '9-ea' returns '9'
|
||||||
|
# - input '9.0.3' returns '9'
|
||||||
|
##########################################################
|
||||||
|
function extractJavaMajorVersion() {
|
||||||
|
java_ver=$1
|
||||||
|
# Java 6, 7, 8 starts with 1.x
|
||||||
|
if [ ${java_ver:0:2} == "1." ] ; then
|
||||||
|
echo ${java_ver} | sed -E 's/1\.([0-9])[0-9_.]{2,6}/\1/g'
|
||||||
|
else
|
||||||
|
# Java 9+ starts with x using semver versioning
|
||||||
|
echo ${java_ver} | sed -E 's/([0-9]+)(-ea|(\.[0-9]+)*)/\1/g'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# helper function:
|
||||||
|
# return comparable version for java version string
|
||||||
|
# basically just strip punctuation and leading '1.'
|
||||||
|
##########################################################
|
||||||
|
function comparableJavaVersionNumber() {
|
||||||
|
echo $1 | sed -E 's/^1\.//g;s/[[:punct:]]//g'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# function:
|
||||||
|
# Java version tester checks whether a given java version
|
||||||
|
# satisfies the given requirement
|
||||||
|
# - parameter1: the java major version (6, 7, 8, 9, etc.)
|
||||||
|
# - parameter2: the java requirement (1.6, 1.7+, etc.)
|
||||||
|
# - return: 0 (satiesfies), 1 (does not), 2 (error)
|
||||||
|
##########################################################
|
||||||
|
function JavaVersionSatisfiesRequirement() {
|
||||||
|
java_ver=$1
|
||||||
|
java_req=$2
|
||||||
|
|
||||||
|
# matches requirements with * modifier
|
||||||
|
# e.g. 1.8*, 9*, 9.1*, 9.2.4*, 10*, 10.1*, 10.1.35*
|
||||||
|
if [[ ${java_req} =~ ^[0-9]+(\.[0-9]+)*\*$ ]] ; then
|
||||||
|
# remove last char (*) from requirement string for comparison
|
||||||
|
java_req_num=${java_req::${#java_req}-1}
|
||||||
|
if [ ${java_ver} == ${java_req_num} ] ; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# matches requirements with + modifier
|
||||||
|
# e.g. 1.8+, 9+, 9.1+, 9.2.4+, 10+, 10.1+, 10.1.35+
|
||||||
|
elif [[ ${java_req} =~ ^[0-9]+(\.[0-9]+)*\+$ ]] ; then
|
||||||
|
java_req_num=$(comparableJavaVersionNumber ${java_req})
|
||||||
|
java_ver_num=$(comparableJavaVersionNumber ${java_ver})
|
||||||
|
if [ ${java_ver_num} -ge ${java_req_num} ] ; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# matches standard requirements without modifier
|
||||||
|
# e.g. 1.8, 9, 9.1, 9.2.4, 10, 10.1, 10.1.35
|
||||||
|
elif [[ ${java_req} =~ ^[0-9]+(\.[0-9]+)*$ ]] ; then
|
||||||
|
if [ ${java_ver} == ${java_req} ] ; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# not matching any of the above patterns
|
||||||
|
# results in an error
|
||||||
|
else
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# find installed Java versions
|
||||||
|
############################################
|
||||||
|
|
||||||
|
apple_jre_plugin="/Library/Java/Home/bin/java"
|
||||||
|
apple_jre_version=$(extractJavaMajorVersion $(extractJavaVersionString "${apple_jre_plugin}"))
|
||||||
|
oracle_jre_plugin="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java"
|
||||||
|
oracle_jre_version=$(extractJavaMajorVersion $(extractJavaVersionString "${oracle_jre_plugin}"))
|
||||||
|
|
||||||
|
# first check system variable "$JAVA_HOME"
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
|
||||||
|
# PR 26: Allow specifying "$JAVA_HOME" relative to "$AppPackageFolder"
|
||||||
|
# which allows for bundling a custom version of Java inside your app!
|
||||||
|
if [[ $JAVA_HOME == /* ]] ; then
|
||||||
|
# if "$JAVA_HOME" starts with a Slash it's an absolute path
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
else
|
||||||
|
# otherwise it's a relative path to "$AppPackageFolder"
|
||||||
|
JAVACMD="$AppPackageFolder/$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check for a specific Java version, specified in JVMversion Plist key
|
||||||
|
elif [ ! -z ${JVMVersion} ] ; then
|
||||||
|
|
||||||
|
# first check "/usr/libexec/java_home" symlinks
|
||||||
|
if [ -x /usr/libexec/java_home ] && /usr/libexec/java_home -F -v ${JVMVersion} > /dev/null 2>&1 ; then
|
||||||
|
JAVACMD="`/usr/libexec/java_home -F -v ${JVMVersion} 2> /dev/null`/bin/java"
|
||||||
|
JAVACMD_version=$(comparableJavaVersionNumber $(extractJavaVersionString "${JAVACMD}"))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# then additionally check the Oracle JRE plugin whether it's a higher/newer compatible version
|
||||||
|
if [ -x "${oracle_jre_plugin}" ] && JavaVersionSatisfiesRequirement ${oracle_jre_version} ${JVMVersion} ; then
|
||||||
|
this_java_ver=$(comparableJavaVersionNumber $(extractJavaVersionString "${oracle_jre_plugin}"))
|
||||||
|
# use this compatible version only if the above returned empty or if the version number is higher
|
||||||
|
if [ -z ${JAVACMD} ] || [ ${this_java_ver} -ge ${JAVACMD_version} ] ; then
|
||||||
|
JAVACMD="${oracle_jre_plugin}"
|
||||||
|
JAVACMD_version=${this_java_ver}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# then additionally check the Apple JRE plugin whether it's a higher/newer compatible version
|
||||||
|
if [ -x "${apple_jre_plugin}" ] && JavaVersionSatisfiesRequirement ${apple_jre_version} ${JVMVersion} ; then
|
||||||
|
this_java_ver=$(comparableJavaVersionNumber $(extractJavaVersionString "${apple_jre_plugin}"))
|
||||||
|
# use this compatible version only if the above returned empty or if the version number is higher
|
||||||
|
if [ -z ${JAVACMD} ] || [ ${this_java_ver} -ge ${JAVACMD_version} ] ; then
|
||||||
|
JAVACMD="${apple_jre_plugin}"
|
||||||
|
JAVACMD_version=${this_java_ver}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVACMD" ] ; then
|
||||||
|
# display human readable java version (#28)
|
||||||
|
java_version_hr=`echo ${JVMVersion} | sed -E 's/[0-9]\.([0-9+*]+)/ \1/g' | sed "s/+/ ${MSG_JAVA_VERSION_OR_LATER}/" | sed "s/*/ ${MSG_JAVA_VERSION_LATEST}/"`
|
||||||
|
# display error message with applescript
|
||||||
|
osascript -e "tell application \"System Events\" to display dialog \"${MSG_ERROR_LAUNCHING}\n\n${MSG_NO_SUITABLE_JAVA}${java_version_hr}.\n${MSG_NO_SUITABLE_JAVA_CHECK}\" with title \"${CFBundleName}\" buttons {\" OK \", \"${MSG_VISIT_JAVA_DOT_COM}\"} default button \"${MSG_VISIT_JAVA_DOT_COM}\" with icon path to resource \"${CFBundleIconFile}\" in bundle (path to me)" \
|
||||||
|
-e "set response to button returned of the result" \
|
||||||
|
-e "if response is \"${MSG_VISIT_JAVA_DOT_COM}\" then open location \"http://java.com\""
|
||||||
|
# exit with error
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
# otherwise check "/usr/libexec/java_home" and Oracle and Apple JRE paths and use highest version available
|
||||||
|
else
|
||||||
|
|
||||||
|
# first check "/usr/libexec/java_home" symlinks
|
||||||
|
if [ -x /usr/libexec/java_home ] && /usr/libexec/java_home -F > /dev/null 2>&1 ; then
|
||||||
|
JAVACMD="`/usr/libexec/java_home 2> /dev/null`/bin/java"
|
||||||
|
JAVACMD_version=$(comparableJavaVersionNumber $(extractJavaVersionString "${JAVACMD}"))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# then additionally check the Oracle JRE plugin whether it's a higher/newer compatible version
|
||||||
|
if [ -x "${oracle_jre_plugin}" ] ; then
|
||||||
|
this_java_ver=$(comparableJavaVersionNumber $(extractJavaVersionString "${oracle_jre_plugin}"))
|
||||||
|
# use this compatible version only if the above returned empty or if the version number is higher
|
||||||
|
if [ -z ${JAVACMD} ] || [ ${this_java_ver} -ge ${JAVACMD_version} ] ; then
|
||||||
|
JAVACMD="${oracle_jre_plugin}"
|
||||||
|
JAVACMD_version=${this_java_ver}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# then additionally check the Apple JRE plugin whether it's a higher/newer compatible version
|
||||||
|
if [ -x "${apple_jre_plugin}" ] ; then
|
||||||
|
this_java_ver=$(comparableJavaVersionNumber $(extractJavaVersionString "${apple_jre_plugin}"))
|
||||||
|
# use this compatible version only if the above returned empty or if the version number is higher
|
||||||
|
if [ -z ${JAVACMD} ] || [ ${this_java_ver} -ge ${JAVACMD_version} ] ; then
|
||||||
|
JAVACMD="${apple_jre_plugin}"
|
||||||
|
JAVACMD_version=${this_java_ver}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# fallback fallback: /usr/bin/java
|
||||||
|
# but this would prompt to install deprecated Apple Java 6
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# execute JAVA commandline and do some pre-checks
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
# display error message if MainClassName is empty
|
||||||
|
if [ -z ${JVMMainClass} ]; then
|
||||||
|
# display error message with applescript
|
||||||
|
osascript -e "tell application \"System Events\" to display dialog \"${MSG_ERROR_LAUNCHING}\n\n${MSG_MISSING_MAINCLASS}\" with title \"${CFBundleName}\" buttons {\" OK \"} default button 1 with icon path to resource \"${CFBundleIconFile}\" in bundle (path to me)"
|
||||||
|
# exit with error
|
||||||
|
exit 2
|
||||||
|
|
||||||
|
|
||||||
|
# check whether $JAVACMD is a file and executable
|
||||||
|
elif [ -f "$JAVACMD" ] && [ -x "$JAVACMD" ] ; then
|
||||||
|
|
||||||
|
# enable drag&drop to the dock icon
|
||||||
|
export CFProcessPath="$0"
|
||||||
|
|
||||||
|
# remove Apples ProcessSerialNumber from passthru arguments (#39)
|
||||||
|
if [[ $@ == -psn* ]] ; then
|
||||||
|
ArgsPassthru=""
|
||||||
|
else
|
||||||
|
ArgsPassthru=$@
|
||||||
|
fi
|
||||||
|
|
||||||
|
# change to Working Directory based upon Apple/Oracle Plist info
|
||||||
|
cd "${WorkingDirectory}"
|
||||||
|
|
||||||
|
# execute Java and set
|
||||||
|
# - classpath
|
||||||
|
# - dock icon
|
||||||
|
# - application name
|
||||||
|
# - JVM options
|
||||||
|
# - JVM default options
|
||||||
|
# - main class
|
||||||
|
# - JVM arguments
|
||||||
|
exec "$JAVACMD" \
|
||||||
|
-cp "${JVMClassPath}" \
|
||||||
|
-splash:"${ResourcesFolder}/${JVMSplashFile}" \
|
||||||
|
-Xdock:icon="${ResourcesFolder}/${CFBundleIconFile}" \
|
||||||
|
-Xdock:name="${CFBundleName}" \
|
||||||
|
${JVMOptions:+$JVMOptions }\
|
||||||
|
${JVMDefaultOptions:+$JVMDefaultOptions }\
|
||||||
|
${JVMMainClass}\
|
||||||
|
${JVMArguments:+ $JVMArguments}\
|
||||||
|
${ArgsPassthru:+ $ArgsPassthru}
|
||||||
|
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
# display error message with applescript
|
||||||
|
osascript -e "tell application \"System Events\" to display dialog \"${MSG_ERROR_LAUNCHING}\n\n${MSG_INSTALL_JAVA}\" with title \"${CFBundleName}\" buttons {\"${MSG_LATER}\", \"${MSG_VISIT_JAVA_DOT_COM}\"} default button \"${MSG_VISIT_JAVA_DOT_COM}\" with icon path to resource \"${CFBundleIconFile}\" in bundle (path to me)" \
|
||||||
|
-e "set response to button returned of the result" \
|
||||||
|
-e "if response is \"${MSG_VISIT_JAVA_DOT_COM}\" then open location \"http://java.com\""
|
||||||
|
|
||||||
|
# exit with error
|
||||||
|
exit 1
|
||||||
|
fi
|
|
@ -58,10 +58,17 @@ public class AppleCommander {
|
||||||
String[] extraArgs = new String[args.length - 1];
|
String[] extraArgs = new String[args.length - 1];
|
||||||
System.arraycopy(args, 1, extraArgs, 0, extraArgs.length);
|
System.arraycopy(args, 1, extraArgs, 0, extraArgs.length);
|
||||||
if ("-swt".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
|
if ("-swt".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
|
||||||
launchSwtAppleCommander(args);
|
if (isSwtAvailable()) {
|
||||||
|
launchSwtAppleCommander(args);
|
||||||
|
} else {
|
||||||
|
System.err.println(textBundle.get("SwtVersionNotAvailable")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
} else if ("-swing".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
|
} else if ("-swing".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
|
||||||
System.err.println(textBundle.get("SwingVersionNotAvailable")); //$NON-NLS-1$
|
if (isSwingAvailable()) {
|
||||||
launchSwingAppleCommander(args);
|
launchSwingAppleCommander(args);
|
||||||
|
} else {
|
||||||
|
System.err.println(textBundle.get("SwingVersionNotAvailable")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
} else if ("-command".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
|
} else if ("-command".equalsIgnoreCase(args[0])) { //$NON-NLS-1$
|
||||||
System.err.println(textBundle.get("CommandLineNotAvailable")); //$NON-NLS-1$
|
System.err.println(textBundle.get("CommandLineNotAvailable")); //$NON-NLS-1$
|
||||||
} else if ("-help".equalsIgnoreCase(args[0]) //$NON-NLS-1$
|
} else if ("-help".equalsIgnoreCase(args[0]) //$NON-NLS-1$
|
||||||
|
@ -133,12 +140,12 @@ public class AppleCommander {
|
||||||
* command-line version.
|
* command-line version.
|
||||||
*/
|
*/
|
||||||
protected static void launchSwingAppleCommander(String[] args) {
|
protected static void launchSwingAppleCommander(String[] args) {
|
||||||
Class<?> swtAppleCommander;
|
Class<?> swingAppleCommander;
|
||||||
try {
|
try {
|
||||||
swtAppleCommander = Class.forName(
|
swingAppleCommander = Class.forName(
|
||||||
"com.webcodepro.applecommander.ui.swing.SwingAppleCommander"); //$NON-NLS-1$
|
"com.webcodepro.applecommander.ui.swing.SwingAppleCommander"); //$NON-NLS-1$
|
||||||
Object object = swtAppleCommander.newInstance();
|
Object object = swingAppleCommander.newInstance();
|
||||||
Method launchMethod = swtAppleCommander.
|
Method launchMethod = swingAppleCommander.
|
||||||
getMethod("launch", (Class[]) null); //$NON-NLS-1$
|
getMethod("launch", (Class[]) null); //$NON-NLS-1$
|
||||||
launchMethod.invoke(object, (Object[]) null);
|
launchMethod.invoke(object, (Object[]) null);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
|
|
|
@ -110,6 +110,7 @@ CommandLineDC42Bad = Unable to interpret this DiskCopy 42 image.
|
||||||
UserPreferencesComment = AppleCommander user preferences
|
UserPreferencesComment = AppleCommander user preferences
|
||||||
|
|
||||||
# AppleCommander
|
# AppleCommander
|
||||||
|
SwtVersionNotAvailable = Sorry, the SWT GUI is not available.
|
||||||
SwingVersionNotAvailable = Sorry, the Swing GUI is not available.
|
SwingVersionNotAvailable = Sorry, the Swing GUI is not available.
|
||||||
CommandLineNotAvailable = Sorry, the command line user interface is not available.
|
CommandLineNotAvailable = Sorry, the command line user interface is not available.
|
||||||
AppleCommanderHelp = AppleCommander general options:\n-swt will launch the SWT version of AppleCommander.\n This requires the SWT jar and dll files to be present.\n-swing will launch the Swing version of AppleCommander.\n (This is not implemented yet.)\n-command will enter command interpreter mode. (This is also\n not implemented yet.)\n-help will show this help text.
|
AppleCommanderHelp = AppleCommander general options:\n-swt will launch the SWT version of AppleCommander.\n This requires the SWT jar and dll files to be present.\n-swing will launch the Swing version of AppleCommander.\n (This is not implemented yet.)\n-command will enter command interpreter mode. (This is also\n not implemented yet.)\n-help will show this help text.
|
||||||
|
|
Loading…
Reference in New Issue