-3

beginner

I've searched the entire internet on how to convert java program to exe but all I see is "convert .jar to exe". there is no jar file in my program. My program is coded in java in eclipse IDE how do I convert this program to an independent application. an executable file. it has three classes. one of them is a main class. I tried using JSmooth but I had no idea what I was even doing.

  • can you direct me to a site on how to build a jar? – user3804014 Jul 12 '15 at 17:58
  • Your questions has 2 subproblems. If you just want an executable, then `.jar` is an executable. If you need a `.exe` file as an executable then first build `.jar` and then convert it to `.exe`. – Shrinivas Shukla Jul 12 '15 at 17:58
  • 1
    Should be closed, asking us to recommend a tool, unclear what is being asked and possible duplicate of http://stackoverflow.com/questions/2272107/how-can-i-convert-a-jar-file-to-an-exe-file – Luke Melaia Jul 12 '15 at 18:03

2 Answers2

1

Desktop/command line Java programs are compiled into .jar files. You can make a "runnable jar" that will launch your program when the user double-clicks it.

Here's how to create a runnable jar in Eclipse: http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftasks-37.htm

  1. From the menu bar's File menu, select Export.
  2. Expand the Java node and select Runnable JAR file. Click Next.
  3. In the Opens the Runnable JAR export wizard Runnable JAR File Specification page, select a 'Java Application' launch configuration to use to create a runnable JAR.
  4. In the Export destination field, either type or click Browse to select a location for the JAR file.
  5. Select an appropriate library handling strategy.

As far as converting your compiled Java .jar into a Windows .exe, you might consider using Launch4j.

spork
  • 1,185
  • 1
  • 11
  • 17
0

Jsmooth wraps you jar into an exe, but its old and outdated. I recommend Launch4J, its easy to use and works well.

http://launch4j.sourceforge.net

Luke Melaia
  • 1,470
  • 14
  • 22