简体   繁体   中英

Executable jar and double-click

I'm in the process of creating a fairly extensive desktop application using SWT. To generate an executable jar file I use maven-shade-plugin in version 2.1. 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

works very well.

Previously, I created a project with SWING with using the same plugin and double click worked without a problem. Is the problem may be to use SWT?

Java version 1.7.0_25 OS Windows 7 Professional x64

You can create a *.bat file with the following content:

start javaw -jar pakiet.jar

I've been using launch4j my my SWT applications, works really well. You can even bundle the jre to avoid any dependencies on the target machine. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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