jcasado94
jcasado94

Reputation: 53

How can I import a library to a Java project in NetBeans?

I needed a class that could create polygons with Double or Float numbers, instead of int numbers. Well, I found it here, and here is the Jar file download. I extracted the Jar and added it to the libraries in NetBeans; but now, I don't know how to import the package to my project. If I type "import org.apache.batik.ext.awt.geom;", it says that the package does not exist. How can I import that package to my project? Thanks!

Upvotes: 5

Views: 46147

Answers (2)

MicSim
MicSim

Reputation: 26816

It's not enough to define the library in Netbeans. You need to add the library to your project. Then your import will work.

After defining the library in Netbeans (under Tools - Libraries) you can add it as follows to the project: Right-click Libraries in your project tree, select Add Library... and then select your newly defined library.

Upvotes: 0

Dixit Wadhwani
Dixit Wadhwani

Reputation: 227

It's very easy.. you just expand the project tree in netbeans and right click to Libraries folder which is in the project.. and select the Add Jar/Folder option and choose your downloaded jar file.. nad click to open.. after that you can able to import these libraries..

prreview

Upvotes: 16

Related Questions