Gautam Reloaded
Gautam Reloaded

Reputation: 41

How can I convert my Java project to an jar file with all the external libraries which i have used in my project?

hi i have converted my java project into jar file by NetBeans and give it to my friend . Whenever he click on that jar he is getting exception and then i have tried from cmd to run it then it was showing error like iText.pdf.* missing .

It means in that jar file the external library which i have used in my project is not there . so guys please give me a solution that how i convert my java project along with the external library i have used into a .exe file

Thanks in advance

Upvotes: 2

Views: 2203

Answers (4)

Mauricio Fabian
Mauricio Fabian

Reputation: 1

In your project properties, add "copy depedent librairies"(under "Build"->"Packaging"):

-> https://i.sstatic.net/REP9o.png

Then, when you build your project, Netbeans will include the lib in a folder called "lib".

Upvotes: 0

Pasupathi Rajamanickam
Pasupathi Rajamanickam

Reputation: 2052

What usually I do is, Just giving clean and build and in netbeans_project_directory/dist folder will be having all necessary things, such as executable jar and lib, you can create a bat file to execute the jar.

Upvotes: 0

mar10
mar10

Reputation: 198

I believe this link should help you with this issue : http://www.oracle.com/technetwork/articles/javase/single-jar-141905.html

This will package every dependent library (*.jar) into one single Project.jar.

Another solution is to use something such as Apache Maven with NetBeans : http://wiki.netbeans.org/Maven

Upvotes: 0

Milkmaid
Milkmaid

Reputation: 1754

You have to use ant, maven or gradle for this things. If you use Eclipse IDE it has own default ant so simply go with right click on project and export to JAR file.

Upvotes: 1

Related Questions