Of course, Jsoup.
import org.jsoup.nodes.Document; import org.jsoup.Jsoup; import org.jsoup.nodes.Element;
Also see the Jsoup API documentation.
However, there is another problem that will only appear when you run it: you pass the url in the flavor of java.lang.String instead of java.net.URL . A String will be considered as plain HTML, not as a resource. Fix it:
URL url = new URL("http://www.apple.com/pr/"); Document document = Jsoup.parse(url, 3000);
Update : you just need to make sure the Jsoup libraries are present both in the compilation class and in the runtime. When using javac.exe and java.exe use the -cp argument. For instance. compile it:
javac -cp .;/path/to/jsoup.jar com/example/YourClass.java
and execute it:
java -cp .;/path/to/jsoup.jar com.example.YourClass
source share