呵呵,@marc 在他的评论中想说的是,根据你的 Linux 风格,你的做法可能会有很大不同。一般来说,您只需要了解如何更改您使用的任何风格的默认“打开方式”行为。您需要告诉它使用 Java 而不是归档程序打开 jar 文件。
Heh, what @marc is trying to say in his comment is that how you do that could be wildly different depending on your linux flavor. In general, you just need to find out how to change the default "Open With" behavior for whichever flavor you're using. You need to tell it to open jar files with Java instead of with the archive program.
一种可能的方法是创建一个文本文件,其中包含该命令 java -jar test.jar,然后授予该文件执行权限。将其命名为 test 然后双击该文件(或者通过命令行只需键入 ./test)
One possible way would be to make a text file with that command java -jar test.jar in it, then give that file execute permissions. Name it test Then you would double click that file (or via the command line just type ./test)
发布评论
评论(4)
使您的文件可执行:
Make your file executable:
呵呵,@marc 在他的评论中想说的是,根据你的 Linux 风格,你的做法可能会有很大不同。一般来说,您只需要了解如何更改您使用的任何风格的默认“打开方式”行为。您需要告诉它使用 Java 而不是归档程序打开 jar 文件。
Heh, what @marc is trying to say in his comment is that how you do that could be wildly different depending on your linux flavor. In general, you just need to find out how to change the default "Open With" behavior for whichever flavor you're using. You need to tell it to open jar files with Java instead of with the archive program.
一种可能的方法是创建一个文本文件,其中包含该命令
java -jar test.jar
,然后授予该文件执行权限。将其命名为test
然后双击该文件(或者通过命令行只需键入./test
)One possible way would be to make a text file with that command
java -jar test.jar
in it, then give that file execute permissions. Name ittest
Then you would double click that file (or via the command line just type./test
)就我个人而言,我会保留 jar 文件不变,并创建一个脚本,该脚本将在单击该命令时执行该命令,然后我只需单击该脚本即可。
你在 Linux 中使用什么窗口管理器/桌面?您可以配置单击 jar 文件的默认操作。
Personally, I'd leave the jar file as is and create a script that will execute the command when it is clicked, then I'd just click on that.
What window manager / desktop are you using in linux? You can likely configure the default action of a click on a jar file.