[英]Running a JAR from the windows contextual menu
I've got a java application packaged as jar, which I am trying to add as a "right click" option for a specific file type in windows. 我有一个打包为jar的Java应用程序,我试图将其添加为Windows中特定文件类型的“右键单击”选项。
I've added the command reg key to the filetype, and the command appears in windows explorer when I rightclick the appropriate file type, but the jar doesn't run successfully. 我已将命令reg键添加到文件类型,并且当我右键单击适当的文件类型时,该命令出现在Windows资源管理器中,但jar无法成功运行。
The value of the (default) command is: (默认)命令的值为:
java.exe "c:\MYAPPDIR\MYAPP.jar %1"
and a command prompt pops up quickly and closes too fast for me to see what is going on. 然后命令提示符迅速弹出,并且关闭速度太快,以至于我看不到发生了什么。
This exact command works mind in a cmd.exe prompt (where %1 is replaced with a valid file name) 此确切命令在cmd.exe提示符下起作用(其中%1被替换为有效的文件名)
I tried java instead of java.exe, and variations on where the quotations go, but no success. 我尝试使用Java而不是java.exe,并在引号的位置进行了各种修改,但均未成功。
How do I format the command? 如何格式化命令? Any help is appreciated!
任何帮助表示赞赏!
You need to create a Runnable Jar File in order for it to run when you click on it. 您需要创建一个Runnable Jar文件,以便在单击它时运行它。 You can run any jar file by doing
java -jar File.jar
. 您可以通过执行
java -jar File.jar
来运行任何jar文件。 You can create a runnable jar file in Eclipse, or you can write the MANIFEST text files by yourself. 您可以在Eclipse中创建可运行的jar文件, 也可以自己编写MANIFEST文本文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.