私は Apple スクリプト作成に非常に慣れていないので、ご容赦ください。.jarを使用してファイルを実行する必要があります。 は実行可能applescriptではないため、 likejarを呼び出します。私のAppleスクリプトは以下のようになります-classcom.path.to.myClass
display alert "You are about to start the image rename process." buttons {"OK", "Cancel"}
set theAnswer to button returned of the result
if theAnswer is "OK" then
do shell script "java -classpath ./ImageRename_JAVA-1.0.0.jar:. com.mff.image.rename.Main"
else
say "Exit"
end if
applescript と the の両方ImageRename_JAVA-1.0.0.jarが同じディレクトリにありますが、スクリプトを実行するとエラーが発生します。
error "Exception in thread \"main\" java.lang.NoClassDefFoundError: com/mff/image/rename/Main
Caused by: java.lang.ClassNotFoundException: com.mff.image.rename.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)" number 1
設定がclasspath間違っていますか?もしそうなら、正しい方法は何ですか?jarまた、にsを追加するにはどうすればよいclasspathですか?
以下のコマンドを実行すると、問題なく実行されTerminalます。
$ java -classpath ./ImageRename_JAVA-1.0.0.jar:. com.mff.image.rename.Main
を使用してより良い方法で実行できることは知っていますが、他の誰かによって開発されたものをJAR Bundler制御することはできません。ディレクトリの下のアプリケーション内JARにすべての s を含めて、それらをクラスパスで使用する方法はありますか?JARYourApplicationName.app/Contents/MacOS/Resources/Java/