Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/365.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将jar运行到apple脚本中_Java_Macos_Jar_Arguments_Applescript - Fatal编程技术网

Java 将jar运行到apple脚本中

Java 将jar运行到apple脚本中,java,macos,jar,arguments,applescript,Java,Macos,Jar,Arguments,Applescript,我需要从带有apple脚本的打包应用程序启动一个.jar文件(带有这些参数) 我尝试使用一个警报框,但它不起作用 on run {input, parameters} set arg_s to "" set sh to "DIR=$(dirname \"$0\") && cd \"$DIR\" || exit; pwd" set pwd to do shell script "/bin/bash -c " & sh's quoted form & " " &a

我需要从带有apple脚本的打包应用程序启动一个.jar文件(带有这些参数)

我尝试使用一个警报框,但它不起作用

on run {input, parameters}

set arg_s to ""

set sh to "DIR=$(dirname \"$0\") && cd \"$DIR\" || exit; pwd"
set pwd to do shell script "/bin/bash -c " & sh's quoted form & " " & (path to me)'s POSIX path's quoted form

repeat with argument in parameters
    copy arg_s & " " & argument to arg_s
end repeat

display notification arg_s with title arg_s subtitle arg_s sound name "Frog"

-- do shell script "java -jar " & pwd & "/Application.app/Contents/Java/App.jar" & result

return input
end run
请参见错误屏幕截图:


非常感谢..

为什么您要循环使用
参数而不是
输入
?因为我是applescript的初学者。谢谢。我用你的信息相应地修改了我的脚本。但是当我试图在命令行上运行我的应用程序时仍然有一个错误:open-a application.app--args a B C D E错误(在警告框上):Automator无法将输入数据转换为所需的类型。您可以尝试将运行时的
{input parameters}
更改为运行时的
argv
。然后将参数中带参数的
repeat更改为argv中带参数的
repeat
。我与此代码有相同的错误:
在运行argv时,将arg设置为argv as list set sh为“DIR=$(dirname\“$0\”&&cd\“$DIR\”| | exit;pwd“将pwd设置为执行shell脚本”/bin/bash-c“&sh的引用表单&&(指向我的路径)'s POSIX path的引用表单显示通知(arg_s的第1项为Unicode文本),标题(argv类)副标题(arg_s类)声音名称“Frog”-do shell脚本“java-jar”&pwd&“/Application.app/Contents/java/app.jar”&result return end run
在脚本之前添加一个测试“Ask for text”,这真是太奇怪了. 然后在命令行上运行应用程序:open-a application.app--args“MyArgument”。应用程序启动良好。但我希望一开始我没有这个领域。。。请看这个截图。没有“询问文本”步骤: