I am trying to run a java file that imports Jsoup classes from the command line using the following line:
javac -classpath "C:\Users\gtdub\JSOUP\jsoup-1.8.3-javadoc.jar;." JsoupTester.java
The type of errors I see are:
JsoupTester.java:1: error: package org.jsoup does not exist
I have quadruple checked the file path and it still will not locate jsoup-1.8.3-javadoc.jar. Is the command line statement I'm using wrong? Here is the java code I am trying to run:
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public class JsoupTester {
public static void main(String[] args) {
String html = "<html><head><title>Sample Title</title></head>"
+ "<body><p>Sample Content</p></body></html>";
Document document = Jsoup.parse(html);
System.out.println(document.title());
Elements paragraphs = document.getElementsByTag("p");
for (Element paragraph : paragraphs) {
System.out.println(paragraph.text());
}
}
}
I also tried adding the file to the windows system variables but I am not sure if that matters.