java 导入 库,导入java库

I am starting to learn a few programming languages. I learned python then did a bit of jython and now want to learn java. I read a basic book but haven't done anything with importing libraries yet. I wanted to try to play around with jsoup for java(since I am familiar with beautifulsoup for python and thought it would make learning a bit easier for me).

But the example I am trying keeps failing( http://jsoup.org/cookbook/extracting-data/example-list-links ). I downloaded jsoup, copied it to libraries/java/extentions and tried the above script but I keep getting:

Exception in thread "main" java.lang.IllegalArgumentException: usage: supply url to fetch

at org.jsoup.helper.Validate.isTrue(Validate.java:45)

at org.jsoup.examples.ListLinks.main(ListLinks.java:16)

At first I thought maybe the library wasn't imported right or I had to do something different to get it in netbeans but when I look at my project, I see a menu for libraries and jsoup seems to be there.

I tried a few other scripts online and am getting errors. I think I might not be importing it right, but can anyone help me identify the problem(I'm such a newbie I don't even know what to google to find the answer to this..)?

Thanks in advance!

解决方案

It's running perfectly.

The code you list (link to) has this as the first thing the program does:

public static void main(String[] args) throws IOException {

Validate.isTrue(args.length == 1, "usage: supply url to fetch");

It requires an argument to be passed into the program on the command line for it to run (an URL). And it's telling you exactly that.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值