1

I just finished making a simple java desktop application.

I want to know how do I combine this app into a single executable file, so that double clicking it will run the application. Right now, I run the application through the IDE, but that's not how I want it to run forever.

Sid
  • 1,239
  • 2
  • 13
  • 36
  • create a batch file/shell script that will call `java` and pass your `.jar`/`.class` to it. – Adi Jul 12 '12 at 11:50
  • 1
    You can have a look over here for your answer: [StackOverFlow : answer][1] [1]: http://stackoverflow.com/questions/804466/how-do-i-create-executable-java-program – Silmarillium Jul 12 '12 at 11:51
  • Just google, "How to make an executable jar file". – user1329572 Jul 12 '12 at 11:51
  • Another way is use something like [One-Jar](http://one-jar.sourceforge.net/) – Adi Jul 12 '12 at 11:52
  • One question that a lot of beginning programmers have is: "Now that I've created my application in the IDE, how do I get it to work from the command line outside of the IDE." Similarly, someone might ask, "How do I distribute this application to other users without having to give them the whole IDE as well?" The answers to these questions are relatively simple, but not necessarily obvious. from: https://netbeans.org/kb/articles/javase-deploy.html – Trade-Ideas Philip Feb 05 '14 at 17:21

1 Answers1

2

I assume you have been using Eclipse IDE.

In your package explorer (usually on the left side), find your Java Project you wish to export, right click in it and choose Export from the menu.

When asked for type, expand the Java folder icon and choose Runnable JAR file.

Under Launch configuration, find and select your class that will run it (the one with main method).
Choose where you want to export it and what you want to do with the other, non-standard libraries you are using.

Click on Finish.

ioreskovic
  • 5,531
  • 5
  • 39
  • 70