Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a standalone application in java [closed]

Tags:

java

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.

like image 658
user2768759 Avatar asked Dec 09 '22 13:12

user2768759


2 Answers

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

like image 168
Raistlin Avatar answered Dec 11 '22 12:12

Raistlin


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!

like image 35
Robert English Avatar answered Dec 11 '22 10:12

Robert English