2016-02-18 13 views
6

Java 1.6でEclipse Indigoプラグインを使用してOS Xでシェルスクリプトを使用してEclipse RCPアプリケーションを起動しようとしています。 OSのバージョンは、スクリプト10.11.3 で次のようになります。OS XでEclipse RCPアプリケーションを起動できません

#!/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" 

私は、次のエラーを取得しています:

!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) 

理由することができ何?

+0

plistまたはiniファイルを更新しても、同じエラーが発生し、システムのVMを使用しています。アプリケーションは特定のjreを使用する必要があります –

+0

別のツールでファイルを解凍し、パス、フォルダ+ファイル名を確認してください....ソース:https://www.eclipse.org/forums/index.php/t/ 24093/ – Joda

+0

ジップはありません。インストーラを作成しようとしています –

答えて

2

Javaコマンドを実行するBashコードでは問題が発生しているようですが、Bashコードにはデバッグが困難な問題があります。 1つの問題は、文字列を使用してコマンド、オプション、および引数を格納することです。パス名の拡張(グロブ)や単語分割の問題を避けるのが難しいため、これは一般的には悪い考えです。別の問題は、evalの使用です。これは避けるのが最善であり、まれにしか必要ありません。これは、コマンドを格納するために配列を使用し、 '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=("[email protected]") 
    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[@]}" 

これは簡単にデバッグする必要があります。 bash -xでそれを実行して、それが何をしているのかを正確に見てください。 cmd_parts=(...)出力の角括弧内にテキストをコピーして貼り付け、プログラムが実行したJavaコマンドを再実行します。うまくいけば、コマンドの何が間違っているのか、それを修正する方法を知ることができます。

+0

Well * someone * FAQを読んでください50! – miken32

関連する問題