在AppleScript中运行Java脚本
好的,我正试图打开一个.jar文件,但不管我怎么做,它总是会出错 我试过:在AppleScript中运行Java脚本,java,jar,applescript,Java,Jar,Applescript,好的,我正试图打开一个.jar文件,但不管我怎么做,它总是会出错 我试过: to run set current_path to POSIX path of (path to me) as string set pathto to current_path & "Contents/Resources/TechnicLauncher.jar" tell application "Finder" to open file pathto end run 错误如
to run
set current_path to POSIX path of (path to me) as string
set pathto to current_path & "Contents/Resources/TechnicLauncher.jar"
tell application "Finder" to open file pathto
end run
错误如下:
错误“Finder出现错误:无法获取文件\”/Applications/Technic
Launcher.app/Contents/Resources/TechnicLauncher.jar\“”编号-1728
从文件“/应用程序/技术
Launcher.app/Contents/Resources/TechnicLauncher.jar“
这是:
to run
set current_path to POSIX path of (path to me) as string
set pathto to quoted form of current_path & "Contents/Resources/TechnicLauncher.jar"
do shell script pathto
end run
错误如下:
错误“sh:/Applications/Technic
Launcher.app/Contents/Resources/TechnicLauncher.jar:权限
“拒绝”126号
我不知道我怎样才能使这项工作成功。有人能帮忙吗?如果你只是想启动它,考虑到这个罐子是用一个普通的.app包装的——你试过了吗
tell application "Technic Launcher"
activate
end tell
你可以试试这个。我没有在我的系统上尝试过它,因为我没有想要打开的jar文件。不过我想这对你会有用的
set TechnicLauncher to (path to me as string) & "Contents:Resources:TechnicLauncher.jar"
tell application "Jar Launcher" to open TechnicLauncher
这也应该对你有用
set TechnicLauncher to path to resource "TechnicLauncher.jar"
tell application "Jar Launcher" to open TechnicLauncher
但是文件TechnicLauncher.jar。。。必须位于已创建的脚本包或脚本应用程序的resources文件夹中