Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit c6432c9

Browse files
committed
Read and set Classpath from Apple Plist
For Oracle Plist, use the default behaviour as it was Thanks to Philipp Holzschneider for this contribution!
1 parent 13f58d9 commit c6432c9

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/universalJavaApplicationStub

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,19 @@ if [ $exitcode -eq 0 ]; then
143143
JavaFolder="${AppleJavaFolder}"
144144
ResourcesFolder="${AppleResourcesFolder}"
145145

146+
APP_PACKAGE="${AppPackageFolder}"
147+
JAVAROOT="${AppleJavaFolder}"
148+
146149
# read the MainClass name
147150
JVMMainClass=`/usr/libexec/PlistBuddy -c "print :Java:MainClass" "${InfoPlistFile}" 2> /dev/null`
148151

149152
# read the JVM Options
150153
JVMOptions=`/usr/libexec/PlistBuddy -c "print :Java:Properties" "${InfoPlistFile}" 2> /dev/null | grep " =" | sed 's/^ */-D/g' | tr '\n' ' ' | sed 's/ */ /g' | sed 's/ = /=/g' | xargs`
151154

155+
# read the ClassPath
156+
JVMClassPath=.`/usr/libexec/PlistBuddy -c "print :Java:ClassPath" "${InfoPlistFile}" 2> /dev/null | tr -d '\n' | sed -E 's/Array \{ *(.*) *\}/\1/g' | sed 's/^ */:/g' | sed 's/ */ /g' | sed 's/ = /=/g' | xargs`
157+
JVMClassPath=`eval "echo ${JVMClassPath}"`
158+
152159
# read the JVM Default Options
153160
JVMDefaultOptions=`/usr/libexec/PlistBuddy -c "print :Java:VMOptions" "${InfoPlistFile}" 2> /dev/null | xargs`
154161

@@ -175,6 +182,8 @@ else
175182

176183
# read the JVM Arguments
177184
JVMArguments=`/usr/libexec/PlistBuddy -c "print :JVMArguments" "${InfoPlistFile}" 2> /dev/null | tr -d '\n' | sed -E 's/Array \{ *(.*) *\}/\1/g' | sed 's/ */ /g' | xargs`
185+
186+
JVMClassPath="${JavaFolder}/*"
178187
fi
179188

180189

@@ -237,7 +246,7 @@ elif [ -f "$JAVACMD" ] && [ -x "$JAVACMD" ] ; then
237246
# - main class
238247
# - JVM arguments
239248
exec "$JAVACMD" \
240-
-cp "${JavaFolder}/*" \
249+
-cp "${JVMClassPath}" \
241250
-Xdock:icon="${ResourcesFolder}/${CFBundleIconFile}" \
242251
-Xdock:name="${CFBundleName}" \
243252
${JVMOptions:+$JVMOptions }\
@@ -257,4 +266,3 @@ else
257266
# exit with error
258267
exit 1
259268
fi
260-

0 commit comments

Comments
 (0)