I did my project in Eclipse. I have *.java
, .project
, .classpath
and *.class
files in my Eclipse workspace. How do I create an executable?now.

- 19,979
- 21
- 92
- 137

- 25
- 1
- 2
- 6
6 Answers
Eclipse will build an executable jar file for you, which is run with Java (java.exe if you're on windows) to launch your application. On a machine correctly set up with Java installed, double clicking an executable jar should run the program.
If you want an exe, then there are ways to do it that will generally wrap the jar file (and sometimes the JDK.) However, first ask yourself why you're doing it this way - often it's just a habitual desire to have an exe, without any great technical reason. All you're really doing through this is taking a cross-platform executable, and making it only work on Windows.
If you're distributing your application and your users expect an exe, then consider building platform dependant installers for each OS you wish to support, but leaving the jar file in tact. The average user will never usually need to touch it directly if your installer places shortcuts in the correct locations, they'll only ever need to run the installer directly (so your application file format becomes irrelevant, just an implementation detail as far as they're concerned.)

- 70,193
- 21
- 157
- 216
You need to create a .jar file from your project. On windows normally with double click those files get executed if a java virtual machine is installed.
There are solutions to wrap an .exe file around your .jar, but I don't know how good they are so I can't suggest anything.

- 7,286
- 6
- 31
- 45
Java executables are runnable .JAR files. You need to export as Runnable Jar.
In Eclipse:
- Right click on your project
- Export
- Export...
- Runnable JAR file

- 1,777
- 17
- 35
-
Executable JAR files. JARs do not imply that they are executable alone. – 75inchpianist Mar 11 '13 at 20:27
-
That's why I said Runnable Jar. – Simon Arsenault Mar 11 '13 at 20:44
-
but you also said 'Java executables are .JAR files' which is not clear. 'Java executables are runnable .JAR files' – 75inchpianist Mar 11 '13 at 21:15
You would have to use chmod in the command line. This argument can change the permission of the file. It depends on three groups. Reading, writing, and executing can all be altered using this argument.

- 133
- 1
- 3
- 11
If you want an IDE agnostic solution, go for launch4j

- 19,979
- 21
- 92
- 137

- 4,711
- 1
- 18
- 28
like in ohter replies mentioned you need to create a jar
file witch packages all your compiled classes. while exporting from eclipse you can optionally export the dependecies that your project needs to run.
if you want to create an exe
file you can use some software witch packages/wraps your jar(s)
into an executable file. you can try jsmooth, it provides several exe wrappers and has the ability to integrate your jar an its dependencies into one single file witch you can distribute and will be per click executed.

- 17,353
- 6
- 49
- 70