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

Commit 79c5f8e

Browse files
committed
fixed reading ClassPath in either Array or String style
Either: <key>Java</key> <dict> <key>ClassPath</key> <string>$JAVAROOT/jarFile.jar</string> </dict> or: <key>Java</key> <dict> <key>ClassPath</key> <array> <string>$JAVAROOT/jarFile.jar </string> <string>$JAVAROOT/</string> </array> </dict> Oracle Plist with Oracle AppBundler doesn't support setting the ClassPath. It will only copy all ClassPath-Resources into the App-Bundle.
1 parent 27724d4 commit 79c5f8e

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/universalJavaApplicationStub

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,13 @@ if [ $exitcode -eq 0 ]; then
153153
# read the JVM Options
154154
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`
155155

156-
# read the ClassPath
157-
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`
156+
# read the ClassPath in either Array or String style
157+
JVMClassPath_RAW=`/usr/libexec/PlistBuddy -c "print :Java:ClassPath" "${InfoPlistFile}" 2> /dev/null`
158+
if [[ $JVMClassPath_RAW == *Array* ]] ; then
159+
JVMClassPath=.`/usr/libexec/PlistBuddy -c "print :Java:ClassPath" "${InfoPlistFile}" 2> /dev/null | grep " " | sed 's/^ */:/g' | tr -d '\n' | xargs`
160+
else
161+
JVMClassPath=${JVMClassPath_RAW}
162+
fi
158163
# expand variables $APP_PACKAGE, $JAVAROOT, $USER_HOME
159164
JVMClassPath=`eval "echo ${JVMClassPath}"`
160165

@@ -183,15 +188,15 @@ else
183188
# replace occurances of $APP_ROOT with it's content
184189
JVMOptions=`eval "echo ${JVMOptions}"`
185190

191+
JVMClassPath="${JavaFolder}/*"
192+
186193
# read the JVM Default Options
187194
JVMDefaultOptions=`/usr/libexec/PlistBuddy -c "print :JVMDefaultOptions" "${InfoPlistFile}" 2> /dev/null | grep -o "\-.*" | tr -d '\n' | xargs`
188195

189196
# read the JVM Arguments
190197
JVMArguments=`/usr/libexec/PlistBuddy -c "print :JVMArguments" "${InfoPlistFile}" 2> /dev/null | tr -d '\n' | sed -E 's/Array \{ *(.*) *\}/\1/g' | sed 's/ */ /g' | xargs`
191198
# replace occurances of $APP_ROOT with it's content
192199
JVMArguments=`eval "echo ${JVMArguments}"`
193-
194-
JVMClassPath="${JavaFolder}/*"
195200
fi
196201

197202

0 commit comments

Comments
 (0)