Make the shortcut/icon execute your application:
java -jar yourApplication.jar org.example.your.MainClass
Question
I have made a desktop application in Java (using JDBC and Swing) using Eclipse. I want to make a shortcut to this application (an icon). When the icon is double clicked, the application will run.
How to do it?
Solution 2
Make the shortcut/icon execute your application:
java -jar yourApplication.jar org.example.your.MainClass
OTHER TIPS
Deploy the app. using Java Web Start. Not only does it have a simple system for installing desk-top and menu item shortcuts (on supported OS) for an app. with icons, but also offers the IntegrationService
that allows the shortcuts to be examined/installed programmatically.
For more details see this answer. The 2 icons on the right hand side (JotPad & StarZoom) were installed by JWS.
If it is a web application - Go to Desktop + Right Click + Select New Option + Select Shortcut option + Specify your path in the location field + Click Next + Type the shortcut name + Finish.
So, now you can view your application as a desktop shortcut and if you click on it, it will automatically load your web application on one click. Then you can change the Shortcut Icons in properties.
Thank you.