I have a java program to parse an html page This is my java program to parse a html page
package com.mkyong;
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public class HTMLParserExample1 {
public static void main(String[] args) {
Document doc;
try {
// need http protocol
doc = Jsoup.connect("http://google.com").get();
// get page title
String title = doc.title();
System.out.println("title : " + title);
// get all links
Elements links = doc.select("a[href]");
for (Element link : links) {
// get the value from href attribute
System.out.println("\nlink : " + link.attr("href"));
System.out.println("text : " + link.text());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
But when in run this code using javac name.java , the following errors occur
java.java:7: package org.jsoup.nodes does not exist import org.jsoup.nodes.Element
from the internet, some said to point the path of jar file , I downloaded the jsoup file and i dont know to how to point it or to install it, PLease help me twith the error
Do i need to modify the code or modify the way of compiling