jpuriol
jpuriol

Reputation: 372

What is the "right" way to add libraries on Netbeans?

I'm a using Netbeans 8.1 to code in Java, when I want to add an external library (such as XStream, JDateChooser, etc) I find the .jar online and I add it to my project through the right clicking in Libraries --> add JAR/Folder.

Screenshot add jar

After this I write my code and everything works fine until I finish my project and I want to export it into a .jar with Clean and Build

Screenshot Clean and Build

I think this maybe because I give an absolute path to the libaray instead of a relative one but I'm not sure.

PS: The library that I'm having trouble with is XStream 1.4.7

Upvotes: 0

Views: 2662

Answers (1)

Nikolas
Nikolas

Reputation: 44368

All the libraries included should pack in a jar file after build. The simplest approach is to click right on your project, select Properties and The project properties. In the new window opened find Categories and Libraries. The in the right side you may see the button Add library/JAR. Probably it's the same way.

Also you can create a Maven project and import all the libraries through dependencies.

Upvotes: 1

Related Questions