简体   繁体   中英

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM