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 dow开发者_运维百科nload. 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!
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..
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.
精彩评论