Java:如何设置htmlunit
我是Java的一个非常大的菜鸟,但我想试试htmlunit。我使用netbeans作为我的IDE,我创建了一个项目文件夹hu1。以下是该文件夹的结构:
I'm a pretty big noob to Java, but I would like try out htmlunit. I'm using netbeans as my IDE and I've created a project folder "hu1". Here is the structure for that folder:
hu1
> nbproject
> src
> hu1
> test
现在,我下载htmlunit 2.7并解压缩文件夹,其中包含一个带有lib文件夹的文件夹一堆jar文件。我在哪里将lib文件夹放在我的netbeans项目文件夹中,以便我可以使用htmlunit?
Now, I download htmlunit 2.7 and unzipped the folder, which contains a "lib" folder with a bunch of jar files in it. Where do I put that lib folder in my netbeans project folder so that I can use htmlunit?
此外,一旦我弄明白了,我将使用哪些路径进行导入。我在网上看到的很多例子都是这样的:
Also, once I have figured that out, what paths do I use for my imports. A lot of examples I've seen on the web use something like this:
import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.Page;
com.gargoylesoftware来自哪里?
Where do the the com.gargoylesoftware come from?
我知道这是一个初学者的问题,我真的应该读一下如何用java编程,但我很感激专家的一些建议。
I know this is a beginner questions, and I really should just read up on how to program with java more, but I would appreciate some advice from the experts here.
更新:这是我的设置图片。
UPDATE: Here is a picture of my setup.
现在,我下载htmlunit 2.7并解压缩该文件夹,其中包含一个带有一堆jar文件的lib文件夹。我在哪里将lib文件夹放在我的netbeans项目文件夹中,以便我可以使用htmlunit?
Now, I download htmlunit 2.7 and unzipped the folder, which contains a "lib" folder with a bunch of jar files in it. Where do I put that lib folder in my netbeans project folder so that I can use htmlunit?
首先,在IDE中注册库。
First, register the libraries in the IDE.
- 在IDE中,选择工具>库以打开库管理器。
- 单击新库并提供名称对于图书馆,例如HTMLUnit
- 选择HTMLUnit库,单击添加JAR /文件夹...按钮,选择之前下载的jar文件,然后单击确定完成
- In the IDE, choose Tools > Libraries to open the Libraries Manager.
- Click New Library and provide a name for the library, e.g. "HTMLUnit"
- With the "HTMLUnit" library selected, click on the "Add JAR/Folder..." button and select the jar file that was downloaded earlier and click OK to complete
替代文字http://wiki.netbeans.org/wiki/images/a/a0/4-1-LibraryManager.png
然后,将库添加到您正在处理的项目中。
Then, add the libraries to the project you are working on.
- 从项目视图中选择项目,右键单击并选择属性
- 在库类别下,单击添加库... 按钮,选择HTMLUnit库并单击OK完成
- Select the project from the Project view, right-click and select "Properties"
- Under the Libraries category, click on the "Add Library..." button and choose the HTMLUnit library and click OK to complete
alt text http://wiki.netbeans.org/wiki/images/3/38/4-2-ProjectPropsAddLibrary.png
(...)com在哪里? .gargoylesoftware来自?
(...) Where do the the com.gargoylesoftware come from?
从库中你必须添加(更确切地说,来自htmlunit罐)。
From the library you have to add (more precisely, from the htmlunit jars).