我是 Java 的新手,所以我为我在这一点上缺乏大量的主题而道歉。我正在尝试编写一个 html 解析器,它分析并返回来自以下 URL 的元素的数据:http ://en.wikipedia.org/wiki/Neurons 。
运行程序时,我不断收到此错误消息:
Exception in thread "main" java.io.FileNotFoundException: src/product.txt`: (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:120)
at org.jsoup.helper.DataUtil.load(DataUtil.java:36)
at org.jsoup.Jsoup.parse(Jsoup.java:88)
at ParserPractice2.main(ParserPractice2.java:16)
我当前的代码如下所示:
import java.io.File;
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.parser.*;
public class ParserPractice2 {
public static void main(String[] args) throws IOException {
File input = new File ("src/product.txt`:");
Document doc = Jsoup.parse(input, "UTF-8", "http://en.wikipedia.org/wiki/Neurons");
Element content = doc.getElementById("bodyContent");
}}*
Any help/feedback would be greatly appreciated by this noobie =)Thanks!