7

I am trying to make an executable file of my Java Application but I don't know how to do that.

I know how to generate an executable jar file, but I want to make an executable application.

I'm using eclipse indigo to make the java application and to generate the jar file.

How to make the executable?

Jan Doggen
  • 8,799
  • 13
  • 70
  • 144
Java Curious ღ
  • 3,622
  • 8
  • 39
  • 63
  • What do you mean by Executable Application? An exe? – Narendra Pathai Aug 27 '13 at 06:46
  • @NarendraPathai - yes sir. – Java Curious ღ Aug 27 '13 at 06:46
  • oh no no, i am beginner in java so want to know about it. otherwise still i don't have posted such a question. – Java Curious ღ Aug 27 '13 at 06:51
  • Maybe this http://stackoverflow.com/questions/147181/how-can-i-convert-my-java-program-to-an-exe-file helps you. It was already asked here on stackoverflow. – Monica Aug 27 '13 at 06:53
  • There are plenty open executable generators available. You can view their source if you are curious. Such type of questions are not good for SO. read http://stackoverflow.com/help/on-topic – Narendra Pathai Aug 27 '13 at 06:54
  • @NarendraPathai - sir if i generate only executable jar file then it will run in all computer but is it necessary to install JRE for that or it's not necessary ? – Java Curious ღ Aug 27 '13 at 08:03
  • Obviously how do you suppose you execute a jar without a JRE installed? JRE - Java Runtime Environment, an environment that is needed to run a java program. Self explanatory. – Narendra Pathai Aug 27 '13 at 08:04
  • @NarendraPathai - Ok thank you sir. that's why i need to make an independent exe file that will run easily on each platform. – Java Curious ღ Aug 27 '13 at 08:06
  • BTW exe will not run on each platform but just Windows. That is the reason Java also has platform dependent installers. There is no way to cater that. – Narendra Pathai Aug 27 '13 at 08:10
  • yes i know that it will run only on windows platform. it's better to make exe of it then to install JRE on all PC. and client PC are windows based. – Java Curious ღ Aug 27 '13 at 08:11

5 Answers5

7

I recommend launch4j to create executables from JAR files.

Moritz Petersen
  • 12,902
  • 3
  • 38
  • 45
1

You can use JSMOOTH to wrap your jar file into .exe file. from wiki ->JSmooth is a tool for wrapping Java JAR files into Windows Portable Executable EXE files.

For more info you can see this answer

Community
  • 1
  • 1
ankit
  • 4,919
  • 7
  • 38
  • 63
1

First export your project as a *.jar in eclipse.

Then, you can use JSmooth to make an *.exe file.

Links:

http://www.vogella.com/articles/Eclipse/article.html

http://jsmooth.sourceforge.net/docs/jsmooth-doc.html

Gokul Nath KP
  • 15,485
  • 24
  • 88
  • 126
1

The most common way to generate an EXE from a jar file is to use whats known as a "wrapper".

one of the more popular wrappers is http://www.jwrapper.com/ which i belive mojang uses to wrap minecraft for windows.

However if you want to generate a purely native EXE that runs as a standalone you will need a native compiler for example: http://jnc.mtsystems.ch.

At the end of the day java is designed to run on a VM double clicking on windows opens it up anyway, but if you really do want to make an EXE then the above methods should work.

tom
  • 354
  • 4
  • 15
0

Many years ago Microsoft use to be able to generate exe from java code, but I do not believe that Eclipse has this feature.

Scary Wombat
  • 44,617
  • 6
  • 35
  • 64
  • then what to do for that ?? any guidance sir ?? – Java Curious ღ Aug 27 '13 at 06:48
  • 1
    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: Download: http://jsmooth.sourceforge.net/ – ankit Aug 27 '13 at 06:51
  • @ScaryWombat believe you're referring to [Visual J++](https://en.wikipedia.org/wiki/Visual_J%2B%2B) – Codebling Dec 16 '15 at 03:06