4

I use eclipse to run my java code, but I want to make an application that won't use eclipse to run. I want to make it work as a portable stand alone application that only uses the libraries I need.

Community
  • 1
  • 1
user2768759
  • 71
  • 1
  • 1
  • 2
  • For what platform? Do you want a jar? An exe? Is it going to be deployed somewhere that already has Java installed? – thegrinner Sep 11 '13 at 13:06
  • 1
    You can export your project to `jar`, select class with main method that should be run when someone execute jar`, also lets not forget to include all libraries. – Pshemo Sep 11 '13 at 13:06
  • Information on how to do that can be found here http://stackoverflow.com/q/423938/586621 – Jay Sep 11 '13 at 13:09

2 Answers2

10

Right click on Projectfolder (in Eclipse) -> Export -> Java -> runnable JAR -> choose class with main method. Done ;)

Raistlin
  • 997
  • 2
  • 11
  • 33
4

I'm going to assume you mean to create a .exe file. for this you'll need a .jar file.

I'm not familiar with Eclipse I know that Netbeans makes the .jar file automatically once the code is compiled.

(For Netbeans) This .jar file can be found in the dist folder. In case there is none see here to fix that.

In case Eclipse puts into a different folder I'd just look in all the folders related to the project until you find a file with a .jar extension.

Once you have the .jar file you'll need to run an application to change it from .jar to .exe , I would recommend Launch4j.

Here's a handy tutorial to help you with that application if you get stuck.

I know this isn't exactly the answer you're looking for but it's close! Hope this helps!

Community
  • 1
  • 1
Robert English
  • 223
  • 1
  • 13
  • Thanks it helped a lot,I am new to java so my questions may be a little unclear,I needed to know how to make .exe file.I found it,thanks. – user2768759 Sep 12 '13 at 11:16
  • I'm just as new I'm sure. I just happened to be looking for the same thing just a little earlier. In my search for an answer I found this question then just provided what I'd found once I'd gotten an answer. Maybe edit your question to help others with the same problem – Robert English Sep 12 '13 at 11:49