@@ -143,12 +143,26 @@ if [ $exitcode -eq 0 ]; then
143143 JavaFolder=" ${AppleJavaFolder} "
144144 ResourcesFolder=" ${AppleResourcesFolder} "
145145
146+ APP_PACKAGE=" ${AppPackageFolder} "
147+ JAVAROOT=" ${AppleJavaFolder} "
148+ USER_HOME=" ` eval echo ~ ` "
149+
146150 # read the MainClass name
147151 JVMMainClass=` /usr/libexec/PlistBuddy -c " print :Java:MainClass" " ${InfoPlistFile} " 2> /dev/null`
148152
149153 # read the JVM Options
150154 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`
151155
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
163+ # expand variables $APP_PACKAGE, $JAVAROOT, $USER_HOME
164+ JVMClassPath=` eval " echo ${JVMClassPath} " `
165+
152166 # read the JVM Default Options
153167 JVMDefaultOptions=` /usr/libexec/PlistBuddy -c " print :Java:VMOptions" " ${InfoPlistFile} " 2> /dev/null | xargs`
154168
@@ -164,17 +178,25 @@ else
164178 ResourcesFolder=" ${OracleResourcesFolder} "
165179 WorkingDirectory=" ${OracleJavaFolder} "
166180
181+ APP_ROOT=" ${AppPackageFolder} "
182+
167183 # read the MainClass name
168184 JVMMainClass=` /usr/libexec/PlistBuddy -c " print :JVMMainClassName" " ${InfoPlistFile} " 2> /dev/null`
169185
170186 # read the JVM Options
171187 JVMOptions=` /usr/libexec/PlistBuddy -c " print :JVMOptions" " ${InfoPlistFile} " 2> /dev/null | grep " -" | tr -d ' \n' | sed ' s/ */ /g' | xargs`
188+ # replace occurances of $APP_ROOT with it's content
189+ JVMOptions=` eval " echo ${JVMOptions} " `
190+
191+ JVMClassPath=" ${JavaFolder} /*"
172192
173193 # read the JVM Default Options
174194 JVMDefaultOptions=` /usr/libexec/PlistBuddy -c " print :JVMDefaultOptions" " ${InfoPlistFile} " 2> /dev/null | grep -o " \-.*" | tr -d ' \n' | xargs`
175195
176196 # read the JVM Arguments
177197 JVMArguments=` /usr/libexec/PlistBuddy -c " print :JVMArguments" " ${InfoPlistFile} " 2> /dev/null | tr -d ' \n' | sed -E ' s/Array \{ *(.*) *\}/\1/g' | sed ' s/ */ /g' | xargs`
198+ # replace occurances of $APP_ROOT with it's content
199+ JVMArguments=` eval " echo ${JVMArguments} " `
178200fi
179201
180202
@@ -237,7 +259,7 @@ elif [ -f "$JAVACMD" ] && [ -x "$JAVACMD" ] ; then
237259 # - main class
238260 # - JVM arguments
239261 exec " $JAVACMD " \
240- -cp " ${JavaFolder} /* " \
262+ -cp " ${JVMClassPath} " \
241263 -Xdock:icon=" ${ResourcesFolder} /${CFBundleIconFile} " \
242264 -Xdock:name=" ${CFBundleName} " \
243265 ${JVMOptions: +$JVMOptions } \
257279 # exit with error
258280 exit 1
259281fi
260-
0 commit comments