How to import zip file in netbeans project

2019-09-15 20:18发布

问题:

when I was trying import a zip file in my netbeans project, I get a error in this line
import jericho-html-3.1.src.java.net.htmlparser.jericho.*;

even though I added the zip file Libraries folder.

回答1:

You probably want to add library to your project so you could call it in your code. From the line import jericho-html-3.1.src.java.net.htmlparser.jericho.*; I assume that you try to add source code to the project. This will not work.

You need to add a library library and not source code. The library file has .jar extension. When you download a zip file from http://sourceforge.net/projects/jerichohtml/files/jericho-html/3.1/ The library is in /jericho-html-3.1/dist/ folder of the zip.

For library usage take a look on Sample Programs.



回答2:

In the Projects window right-click on the name of the project that lacks library -> Properties -> The Project Properties window opens. In Categories tree select "Libraries" node -> On the right side of the Project Properties window press button "Add JAR/Folder" -> Select jars you need.

You also can see MockerTim's short Video How-To.