0

I have added jsoup.jar, but why I can't import org.jsoup.Jsoup:

enter image description here

Jake
  • 131
  • 2
  • 5
  • 13
  • Why do you want to import `org.jsoup.Jsoup`? If i'm not mistaken the `org.jsoup` is enough and you can reference it from the code with `Jsoup.someMethodName()` – Indrek Kõue Apr 08 '12 at 17:55

3 Answers3

0

I've literally been searching for the exact same answer to this question. While searching - and finding - your question I also found this answer: https://stackoverflow.com/a/3643015/1087283 I copy and pasted the example from: http://xjaphx.wordpress.com/2012/02/04/android-xml-adventure-parsing-html-using-jsoup/ and it worked like a charm. Hope this helps.

Community
  • 1
  • 1
dl_evans
  • 5
  • 5
  • What's the error you're getting? In my eclipse project in "Referenced Libraries" it just says "jsoup-1.6.2.jar" not "jsoup-1.6.2.jar D:\path\to\jsoup.jar" So you're still not importing it correctly if it shows D:\Android\path\to\jsoup.jar – dl_evans Apr 13 '12 at 06:36
0

You can do this...

import org.jsoup.*;

and it will import the JSoup module...

Randall.Cummins
  • 426
  • 1
  • 8
  • 20
  • But after I import org.jsoup.*, I can't call JSoup function – Jake Apr 11 '12 at 13:50
  • 1
    ah right!, you know I had the same thing happen to me right after I got back to working on a project... Eclipse can't find the jsoup jar, like it says so you need to right click your project, go to properties >> java Build Path >> click the libraries tab >> ADD External Jars... then you find jsoup from there. – Randall.Cummins Apr 12 '12 at 13:30
0

I had the same problem, and I solved it. The problem is that you added the javadoc jar instead of the core jar. On the download section of Jsoup, you probably downloaded the jsoup-version-javadoc.jar instead of jsoup-version.jar.

I had the same list of on the Eclipse completation, but well, of course the core was not there. So, just download the .jar file of the core, and add it as you did before.

Eduardo
  • 4,282
  • 2
  • 49
  • 63