Pack or convert .java file into .exe

This tutorial covers how to convert or pack Java class file(s) into an exe file or program. This tutorial does not covers how to do programming in Java language. This tutorial uses JSmooth software to convert or pack Java class file into an exe file or program.


  • Basic understanding of Java programming
  • Any version of Windows operating system (preferable Windows 7 and above)
  • Your favorite editor such as notepad++, geany, atom, vim etc.
  • JDK installed and PATH environment variable configured or set
  • Download JSmooth from here and install it.
  • Your favorite logo, recommended size 512 by 512 pixels (optional)


For the demonstration, we are going to write basic java program (hello world in Java).

  1. Open your favorite editor, and write a java program to display “hello world” (without quotes) in console.
    You can copy the program from below, paste it and save it with the name

     /* Java program to print Hello world... */
     public class HelloWorld {
         public static void main(String[] args) {
                 System.out.println("Hello world...");
  2. Open a command prompt and navigate to the directory where you saved the program. Compile the program from command prompt.


    You can execute the program in the command prompt to check whether the program is working correctly or not. Use the following command to execute it.

     java HelloWorld
  3. Now the class file must be converted into a jar file and then this jar file is packed into an exe. Using following command convert HelloWorld.class file into a jar.

     jar cvfe HelloWorld.jar HelloWorld HelloWorld.class

    The entire command is divided into 5 parts.


    jar command which initiates the process.

    cvfe command-line arguments.

    c - create new archive (effectively new jar file)
    v - generate verbose output
    f - specify archive filename (output jar filename)
    e - specify application entry point. This option is required if the manifest file is not explicitly specified in the command. This argument instruct to create a one.

    HelloWorld.jar output archive name or output jar filename.

    HelloWorld Name of the class containing the main method. This class name is added to the newly created manifest file. This information in the manifest file specifies the entry point of the application.

    HelloWorld.class Name of the class to be added to the jar. If you have more than one class file, specify them using the * notation (i.e., *.class).

    If the command is successful, it’ll display output as above. This output indicate the name of the output archive or jar name list of classes added.

  4. Open Jsmooth


  5. Click on skeleton option in the left menu then choose console wrapper in the skeleton selection section. Scroll down and check press key. This will ensure that console is open even after completion of program execution.


  6. Click on Application option in the left menu then in Main class specify the class name containing the main method. In Embedded jar settings check Use an embedded jar and select the jar file.


  7. Click on Executable option in the left menu then in Executable settings specify the full output path including the name of the output executable file with .exe.extension. In Executable icon select an icon.


  8. Click on JVM selection option in the left menu and specify the minimum and maximum version of JVM required in Java versions settings section.


  9. Go to Project menu and click on compile. It will ask to save the current JSmooth project, save it then it will display compilation dialogue window. The executable file is available at the location specified in step 7.


    to check whether the executable is created without any errors, open a command prompt navigate to the directory where the output file is stored, enter the file name with .exe extension.


Note: After successfully completing this tutorial you can tweak other settings to create awesome applications.

This post is licensed under CC BY 4.0 by the author.