Subscribe to Dogstopper's Code Mania        RSS Feed

Java Executables

Icon 10 Comments
One of the most common beginner questions that I hear from Java beginners is "How to make Java executable file". Well, there are several interpretations of this:

How do I make an executable Java program?
How do I make a native executable Java program?

The first question is easily answered using the built-in executable JAR option that Sun/Oracle provides:

If you do it through an IDE like Netbeans or Eclipse, you can look at those specific ways to compile a Jar. In Eclipse, you click "File" then "Export". From there, just follow the instructions. In Netbeans, you simply have to run it an look in the /dist directory of your project.

However, these simply create JAR files which are executable on any platform. However, many Windows and MAC users like to have a native application that they can have an icon for and have a familiar extension (.exe for Windows). Now, there are many reasons to and not to do this, and I advise you to read here:

For Windows, I found that the easiest free application to use that works quite well is Launch4J. IT is easy to use and produces Windows executables FROM an executable Jar file.

I don't use Mac, but I found an article here that looks like it will work, but no promises:

Now, when developing and releasing Java programs, it is always good to release more than one version. ALWAYS release at least the JAR and then after that, you should include all your native executables. When using SourceForge like I do, there are options to specify what downloads are recommended for each Operating System. For example, if you visit my DICBrowser page from a Windows machine, the green Download button links to a .exe, whereas if you visit from Linux or mac or anything else, it links to the JAR. HOWEVER, there are alternative files to download as well.

That's all I have so far on executable files in Java. I hope it answers many questions!

10 Comments On This Entry

Page 1 of 1


11 September 2010 - 01:11 PM
The title is a bit misleading. The first thing that came to mind was calling executable files from within Java, i.e. exec().


11 September 2010 - 01:18 PM


11 September 2010 - 01:28 PM
Much clearer now. :)


11 September 2010 - 01:40 PM
very informative. i have always wondered how to create a .exe from a jar. great to know that it isnt a huge pain to do.


12 September 2010 - 03:40 PM
This is a less ideal solution possibly, but you can also use the GCJ compiler to build native executables



12 September 2010 - 06:44 PM
I did try to use that before and like your tutorial said, it hardly works for Swing...or Generics...or anything past 1.1

I do think it has potential, just not yet.


12 September 2010 - 07:10 PM
Pretty good read on GCJ being used for real stuff:


11 May 2011 - 12:14 PM
So you can convert the jar file to an exe so people who have Windows users don't have to worry about having the correct JDK installed. What about Mac and Linux users? I have friends that use both and if I create my application to run on their computers won't they have to have the correct JDK installed?


11 May 2011 - 01:26 PM
I don't generally support Mac, and linux users should know enough to not be hassled by an "easy" app.


04 July 2011 - 12:20 PM
I appologize for posting this late, but I was looking for a way of how to make an installer for a java application when I bumped into your post. I did some googling and I found GlassWork, and it is pretty good, but I was expeting you could give me some hints there.
Thanks in advance.
Page 1 of 1

October 2020

1819202122 23 24

Recent Entries

Search My Blog

Recent Comments

1 user(s) viewing

1 Guests
0 member(s)
0 anonymous member(s)