Convert Jar file to EXE executable.

I remember the day when I created a Tic Tac Toe game using Java Swing and packed it in an executable JAR file to distribute it among my friends. As few of my friends were not from computer background, they were unable to execute the JAR file. Hence I converted the JAR into EXE and send them the EXE.

It is sometime desirable to convert the JAR file in to EXE (executable) and distribute the EXE. Although the exe can be executed only in Windows environment, this will definitely affects the “platform independency” of a Java program. Still if you want to convert a JAR file in EXE then following tools are for you.

JSmooth .exe wrapper

java jar file to exe executable JSmooth is a Java Executable Wrapper. It creates native Windows launchers (standard .exe) for your java applications. It makes java deployment much smoother and user-friendly, as it is able to find any installed Java VM by itself. When no VM is available, the wrapper can automatically download and install a suitable JVM, or simply display a message or redirect the user to a web site.

JSmooth provides a variety of wrappers for your java application, each of them having their own behaviour: Choose your flavour!

Download: http://jsmooth.sourceforge.net/

JarToExe 1.8

Jar2Exe is a tool to convert jar files into exe files.
Following are the main features as describe in their website:

  • Can generate “Console”, “Windows GUI”, “Windows Service” three types of exe files.
  • Generated exe files can add program icons and version information.
  • Generated exe files can encrypt and protect java programs, no temporary files will be generated when program runs.
  • Generated exe files provide system tray icon support.
  • Generated exe files provide record system event log support.
  • Generated windows service exe files are able to install/uninstall itself, and support service pause/continue.
  • New release of x64 version, can create 64 bits executives. (May 18, 2008)
  • Both wizard mode and command line mode supported. (May 18, 2008)

Download: http://www.brothersoft.com/jartoexe-75019.html

Executor

Package your Java application as a jar, and Executor will turn the jar into a Windows exe file, indistinguishable from a native application. Simply double-clicking the exe file will invoke the Java Runtime Environment and launch your application.

Download: http://mpowers.net/executor/

Advanced Installer

Advanced Installer lets you create Windows MSI installs in minutes. This also has Windows Vista support and also helps to create MSI packages in other languages.
Download: http://www.advancedinstaller.com/

Let me know other tools that you have used to convert JAR to EXE. And also comments/reviews about these tools.

If you read this far, you should follow me on twitter here.



68 Comments

  • Faizan Ansari 3 June, 2013, 19:13

    Hi, can you please tell me how can we wrap up SQL files with these? I mean if I am building an application with Java + SQL server, how will I wrap both of them together to make a installable package?

    Thanks!

    • TyranX 29 June, 2013, 7:32

      In my point of view about your question., you cannot pack both application and SQL server in one package unless the database you are using is embedded in your java application…

  • Rashed khan 5 June, 2013, 0:09

    help me to make .exe with of .jar with database (MySQL) i badly need it

  • naim 26 August, 2013, 16:44

    how i connect whole things with ur code ?

  • SK Sahu 16 September, 2013, 21:50

    Thank you Viral,
    Your information and tutorial, both are most helpful.

  • Dewang 20 December, 2013, 15:04

    Hi,

    These s/w very helpful to make exe , and also thnx to u to give info. about jar to exe but i have a prob in my exe.
    Actually i m using mysql db so i can’t integrate in exe, i can’t make sql connection , how can do this???

    Please help??

  • maxxas 31 December, 2013, 21:20

    I wrote an application which takes an .xls file with account information (account nr., swift code) and generates another .xls file, where IBAN and BIC code are there.

    The application works via an internet site (through AJAX controller), where it retrieves the IBAN and BIC with the help of account nr. and swift code (it takes some time until you’ve got the information). The output .xls is saved in the project directory ( writableWorkbook.write() ).

    The application works from JDeveloper but does not work from .jar or .exe file (I wrapped the .jar-file with launch4j). Do you have an idea what the problem could be? Thx in advance!..

  • Paul Linehan 8 January, 2014, 0:09

    To all those who wish to embed a database – why not
    simply use Apache Derby or H2 or HSQL or similar
    java database?
    HTH,

    Paul…

  • swapnil 4 April, 2014, 15:57

    hi, i create a program in jFrame with database
    when i create it’s jar file it not support an mysql database.
    plz help me regarding this problem.

  • Balaji 25 June, 2014, 12:51

    After generating the exe, when i double click on it i am getting an error message like “The main class could not be found”.Could you suggest on resolving the same.

    -balaji

Leave a Reply

Your email address will not be published. Required fields are marked *

Note

To post source code in comment, use [code language] [/code] tag, for example:

  • [code java] Java source code here [/code]
  • [code html] HTML here [/code]

Current day month ye@r *