How to create Java Executable JAR
The following video shows creating an executable JAR file in Java.
- Create a simple standalone java application, for instance a simple Swing UI application.
- Compile and run the application for sanity.
- Create a manifest file with Main-Class attribute.
- Ensure to enter a new line at the end of manifest file.
Otherwise some systems may throw failed to load Main-Class error.
- Execute JAR command from the console (Ensure to include JDK_HOME\bin in Path environment variable).
- Run the executable JAR from the console and "Open with" windows dialog.
Download Source code for this article (1 KB)