I am trying to launch an Eclipse RCP Application using Shell Script on OS X using Eclipse Indigo plugin with Java 1.6. The version of OS is 10.11.3 The script is as follows:
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
app_cmd="\"$DIR/../Resources/jre/Contents/Home/bin/java\"
-XstartOnFirstThread
-Xdock:name=GS\ Risk
-Xdock:icon=\"$DIR/../Resources/AppIcon.ico\"
-Dorg.eclipse.swt.internal.carbon.smallFonts
-Dosgi.console.enable.builtin=true
-jar \"$DIR/../Resources/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar\"
-data @noDefault
-Dfile.encoding=UTF-8
-os macosx
-ws cocoa
-arch x86_64
-nl en_US
-consoleLog
-console
-showsplash
AppName"
runCommand() {
typeset cmnd="$*"
typeset ret_code
echo cmnd=$cmnd
eval $cmnd
ret_code=$?
case $ret_code in
0)
printf "[%s] exit OK." "$NAME"
;;
23)
printf "[%s] requested a restart. Restarting..." "$NAME" r
unCommand "$cmnd"
;;
*)
printf "Error : [%d] when executing command: '$cmnd'" $ret_code
;;
esac
printf "\n"
exit $ret_code
}
runCommand "$app_cmd"
I am getting the following error:
!SESSION Thu Feb 18 21:50:11 GMT+05:30 2016 ------------------------------------
!ENTRY org.eclipse.equinox.launcher 4 0 2016-02-18 21:50:11.660
!MESSAGE Exception launching the Eclipse Platform:
!STACK
java.lang.RuntimeException: Could not find framework
at org.eclipse.equinox.launcher.Main.getBootPath(Main.java:978)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:557)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
What can be the reason?
Open the folder C:\Program Files\eclipse . Right click on the Eclipse application ( eclipse.exe, with the little purple circle icon next to it) file icon and select Pin to Start Menu . This creates a new shortcut in the start menu which you can now go to open Eclipse.
Launch the Eclipse application and click on Eclipse in the menu bar. Select About Eclipse in the drop-down menu. Click on the Installation Details button in the bottom left corner. In the Installed Software tab, select an Eclipse plugin you want to delete and click on the Uninstall button below the list of the items.
It looks like the problem is with the Java command that is run rather than with the Bash code that runs it, but the Bash code has problems that make it difficult to debug. One problem is that a string is used to store a command, options, and arguments. This is generally a bad idea because it makes it difficult to avoid problems with pathname expansion (globbing) and word splitting. Another problem is the use of eval
, which is best avoided, and rarely necessary. This is a slightly modified version of the code that uses arrays to store the command and doesn't use 'eval':
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
app_cmd_parts=(
"$DIR/../Resources/jre/Contents/Home/bin/java"
-XstartOnFirstThread
-Xdock:name='GS Risk'
-Xdock:icon="$DIR/../Resources/AppIcon.ico"
-Dorg.eclipse.swt.internal.carbon.smallFonts
-Dosgi.console.enable.builtin=true
-jar "$DIR/../Resources/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar"
-data @noDefault
-Dfile.encoding=UTF-8
-os macosx
-ws cocoa
-arch x86_64
-nl en_US
-consoleLog
-console
-showsplash
AppName
)
runCommand() {
typeset cmd_parts=( "$@" )
typeset ret_code
printf 'cmd_parts=('
printf ' %q' "${cmd_parts[@]}"
printf ' )\n'
"${cmd_parts[@]}"
ret_code=$?
case $ret_code in
0)
printf "[%s] exit OK." "$NAME"
;;
23)
printf "[%s] requested a restart. Restarting..." "$NAME" runCommand "${cmd_parts[*]}"
;;
*)
printf "Error : [%d] when executing command: '${cmd_parts[*]}'" $ret_code
;;
esac
printf "\n"
exit $ret_code
}
runCommand "${app_cmd_parts[@]}"
This should be easier to debug. Run it with bash -x
to see exactly what it is doing. Copy and paste the text between the brackets in the cmd_parts=( ... )
output to re-run the Java command that the program ran. Hopefully that will enable you to determine what is wrong with the command, and how to fix it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With