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.