在Linux中执行jar文件 [英] Executing a jar file in Linux

查看:103
本文介绍了在Linux中执行jar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个可执行的Java .jar文件。也就是说,我正确打包了一个java程序.jar文件,包括META-INF / MANIFEST文件

I have created an executable Java .jar file. That is to say, I properly packaged a java program inside a .jar file, including a META-INF/MANIFEST file.

(顺便提一下,在安装了Java的大多数Windows机器上,.jar文件已注册到以 javaw.exe -jar%1 之类的方式运行,这样你就可以双击那些以这种方式准备好的罐子。)

(Incidentally, on most Windows machines with Java installed, .jar files are registered to run as something like javaw.exe -jar %1, so you can just double click jars that have been prepared in that way.)

我刚刚将同一个文件复制到Linux中并试图做同样的事情。

I just copied the same file into Linux and tried to do the same thing.

但是,当我点击该文件时它只是打开jar作为一个zip文件,而不是调用java。

But, when I click on that file it is just opening the jar as a zip file, rather than invoking java.

如何配置我的Linux系统,以便当我双击jar文件时jar内的程序执行?也就是说,当我双击test.jar时,如何让我的系统调用类似 java -jar test.jar 的东西?

How can I configure my Linux system so that the program inside the jar executes when I double click on the jar file? That is, how can I make my system invoke something like java -jar test.jar when I double click test.jar?

推荐答案

嘿,@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.

这篇关于在Linux中执行jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆