How to execute JAVA program by double clicking on icon?

Create a bat or sh file, depending on the operating system, and put java -jar ApplicationName.jar in that file.

You can double click on that file to launch your application.

Example for Windows:

Create a file MyProgram.bat. Open the file in a text editor. Add java -jar MyApplicationName.jar (replace MyApplicationName by the name of your application/the name of the jar). Save the file. Double click the created file to open your program.

Leave a Comment