开发者

Run Java applications By double click

开发者 https://www.devze.com 2023-01-29 23:56 出处:网络
why i can`t run my java compiled applications with double click? my applicatins just run 开发者_开发问答in cmd (java -jar: my app.jar)

why i can`t run my java compiled applications with double click? my applicatins just run 开发者_开发问答in cmd (java -jar: my app.jar) plz help me


You can make a batch file to run your command. This way it will work without the need to make associations to .jar files. If it is a windows app then start it with javaw.exe.


You need to associate the .jar extension with javaw.exe, then no console window will be shown, when you double click the jar file

This is usually done by the JDK/JRE installer, so either you didn't install the JDK properly, or you manually changed that associaten.


I think all the answer here are valid. But if you want a true executable file in Windows then you need to create a launcher. In windows, jar files are not executable. But exe files are. There are many tools out there than wrap all your java code around some native library. I recommend http://launch4j.sourceforge.net/ I think this is what you are looking for. You can easily create executable with icons and many more features.


You can create a Windows shortcut to your .jar file.

The following line could be the target of the Windows shortcut.

%windir%\system32\javaw.exe -Xms1m -Xmx1m -jar "C:\Program Files\Jar Directory\file.jar"

This has the advantage of allowing you to specify the javaw parameters that you want, as well as the Windows parameters (normal window, maximized, start in directory) that you want.


Just assign .jar files to be executed by javaw.exe. You can do that using the Open with dialog on a .jar file.

BTW, doesn't the Java installer do that for you?

0

精彩评论

暂无评论...
验证码 换一张
取 消