简体   繁体   English

具有外部库的可运行jar

[英]runnable jar with external libraries

I created a program and I have to make a jar executable. 我创建了一个程序,并且必须使jar可执行。 Nothing of witchcraft. 没有巫术。 This done with eclipse under windows, when I type in the console: java -jar monJar.jar everything is OK. 当我在控制台中键入以下内容时,这在Windows下使用eclipse完成:java -jar monJar.jar一切都OK。 When I double-click myJar.jar, the program starts and closes immediately. 当我双击myJar.jar时,程序将启动并立即关闭。 For information, I include the external jar RXTXcomm.jar which offers an API to the COM ports. 有关信息,我包括外部jar RXTXcomm.jar,它为COM端口提供API。

With run at console, "java.exe" in windows processes. 随着在控制台上运行,“ java.exe”将在Windows进程中运行。 With double-click on myJar.jar, "javaw.exe * 32" in windows processes. 在myJar.jar上双击Windows进程中的“ javaw.exe * 32”。

After many forums and tutorials reading, you are my last hope. 在阅读了许多论坛和教程之后,您是我的最后希望。

Thank you 谢谢

I try many things with Erwin's links without success. 我尝试用Erwin的链接做很多事情而没有成功。 I made a bat file and I think I will work with it for a while. 我做了一个蝙蝠锉,我想我会用它一段时间。 In the past, I made .exe on other projects with launch4j and Ant. 过去,我使用launch4j和Ant在其他项目上创建了.exe。 When I have time, I will do the same. 有时间的时候,我会做同样的事情。 I'm very disappointed that is so difficult to make a simple jar. 我非常失望,很难制作一个简单的罐子。 If I find a solution some day, I will tell you. 如果有一天我找到解决方案,我会告诉您。

Thanks to everyone. 谢谢大家。

try launch4j tool. 尝试launch4j工具。 It converts your jar into exe taking care of all other configurations. 它将您的jar转换为exe,并负责所有其他配置。

You can configure it to maven also. 您也可以将其配置为Maven。 I fount this link useful. 我认为此链接很有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM