创建不需要java命令的100%独立可执行jar [英] creating 100% standalone executable jar that doesn't require the java command

查看:206
本文介绍了创建不需要java命令的100%独立可执行jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果你创建一个可执行的jar,为了运行它,你仍然需要java命令:

so apparently if you create an executable jar, in order to run it you still need the java command:

java -jar something.jar

但是,如果我只是想让它运行没有java命令,所以只是直接从命令行

but what if I just want it to run without the java command, so just directly from the command line

something.jar 

有没有办法在eclipse中导出我的java应用程序,以完成这样的

is there a way to export my java app in eclipse in order to accomplish such

推荐答案

Excelsior JET - http://www.excelsior-usa.com/jet.html - 声称编译为本机代码并带来自己的运行时支持,因此不需要现有的JVM。商业产品。

Excelsior JET - http://www.excelsior-usa.com/jet.html - claims to compile to native code and bring its own runtime support, so it does not require an existing JVM. Commercial product.

我没有自己尝试过,但是多年来他们花费了相当多的精力来推出JET作为预编译二进制程序的一个很好的部署方法。

I have not tried it myself, but they have spent quite a bit of effort over the years to market JET as a great deployment method for precompiled binaries.

另请注意,如果您有一个可执行/可运行的jar,它可以与java -jar someting.jar和您只需要以更方便的方式调用它,这是程序接受命令并启动java命令的工作。

Also note that if you have an executable/runnable jar which works fine with "java -jar someting.jar" and you just want to be able to invoke it in a more convenient way, this is the job of the program accepting your command and launching the java command.

对于Linux,您可以经常添加一个别名,称某事扩展为java -jar something.jar,一些命令解释器允许以jar结尾的所有命令都应该被特别执行。具体细节取决于您使用的是哪个shell(命令行解释器)。

For Linux you can frequently add an alias saying that "something" expands to "java -jar something.jar", and some command interpreters allow for saying that all commands ending with jars should be executed specially. The exact details depend on which shell (command line interpreter) you are using.

这篇关于创建不需要java命令的100%独立可执行jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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