2017-03-09 93 views
1

我想在java中製作一個web解析器。我正在使用jsoup。但我喜歡這個 未找到jsoup select()方法

錯誤如何解決它?是因爲我的類路徑嗎? enter image description here

也該是我進口 enter image description here

回答

0

使用下面的代碼。

Document doc = Jsoup.connect(I).get(); 
Elements links = doc.select("div#content > p").first(); 
+0

我仍然得到相同的錯誤 – amel

+0

我想你有多個導入語句,所以請檢查重複的元素是否導入或不導入。 –

+2

你輸入了錯誤的文檔類。除去javax.swing.text.Document導入。 –

0

您必須從Connection獲取文檔。

Connection con = Jsoup.connect(url); 
Document doc = con.get(); 
+0

我得到一個錯誤= org.jsoup.nodes.Document不能轉換爲javax.swing.text.Document – amel

+0

使用這個import:import org.jsoup.nodes.Document; –

相關問題