I have problem with importing jar file and running in Geany IDE. This is what I do:
I have downloaded Jsoup. Extracted it and placed org file in my project directory. Then imported it to my source code:
import org.jsoup.*;// why this does not import all
/*
instead I need to import everything manually
import org.jsoup.Jsoup;
import org.jsoup.helper.Validate;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
*/
public class Crawler {
public static void main (String args[]) {
String html = "
First parse"+ "
Parsed HTML into a doc.
";Document doc = Jsoup.parse(html);
}
}
When I tried to compile it within Geany it gave me error:
Crawler.java:7: cannot find symbol
symbol : class Document
symbol : class Document
symbol : class Document
What I am doing wrong, how can I fix it?
解决方案
Download the jar file and place the external jar in some \lib directory and add it to your project's classpath. As a good practice, instead of wildcard imports org.jsoup.* use org.jsoup.Document