简体   繁体   English

可执行jar并双击

[英]Executable jar and double-click

I'm in the process of creating a fairly extensive desktop application using SWT. 我正在使用SWT创建相当广泛的桌面应用程序。 To generate an executable jar file I use maven-shade-plugin in version 2.1. 为了生成可执行的jar文件,我在2.1版中使用了maven-shade-plugin。 After generating a file, typical double-clicking does not work (the system tries to open a few seconds and stops). 生成文件后,典型的双击不起作用(系统尝试打开几秒钟并停止)。 Calling from the console 从控制台呼叫

java -jar pakiet.jar java -jar pakiet.jar

works very well. 效果很好。

Previously, I created a project with SWING with using the same plugin and double click worked without a problem. 以前,我使用相同的插件通过SWING创建了一个项目,双击即可正常工作。 Is the problem may be to use SWT? 问题可能出在使用SWT吗?

Java version 1.7.0_25 OS Windows 7 Professional x64 Java版本1.7.0_25 OS Windows 7 Professional x64

You can create a *.bat file with the following content: 您可以创建具有以下内容的* .bat文件:

start javaw -jar pakiet.jar 启动javaw -jar pakiet.jar

I've been using launch4j my my SWT applications, works really well. 我在我的SWT应用程序中一直使用launch4j ,效果很好。 You can even bundle the jre to avoid any dependencies on the target machine. 您甚至可以捆绑jre以避免对目标计算机的任何依赖。 Supports a splash screen, icon for the exe, you can enforce single instance of the exe, min/max jre versions, graceful error message if jre not supplied etc etc. 支持启动画面,exe图标,您可以强制执行exe的单个实例,最小/最大jre版本,如果未提供jre则显示优美的错误消息等。

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

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