0

I have the .jar file of jsoup.I referred to this link to clear my doubts. But the solution given there is not working.Even after giving that command,i am getting the following error.

Here is the error.Can someone help me with this.

G:\javap>javac -cp .;jsoup.jar Jsou.java
Jsou.java:9: error: cannot find symbol
 Document doc=Jsoup.connect("www.javatpoint.com").get();
 ^
  symbol:   class Document
  location: class Jsou
Jsou.java:9: error: cannot access Jsoup
 Document doc=Jsoup.connect("www.javatpoint.com").get();
              ^
  bad class file: .\Jsoup.class
    class file contains wrong class: org.jsoup.Jsoup
    Please remove or make sure it appears in the correct subdirectory of the cla
sspath.
2 errors
Community
  • 1
  • 1
asad_hussain
  • 1,959
  • 1
  • 17
  • 27
  • .class files of Document and Jsoup must be present in the jar file.Then Why its giving the error "cannot find symbol" ??? – asad_hussain Mar 02 '16 at 04:37
  • Can you edit your question and add the `Jsou.java` source code? – Jonny Henly Mar 02 '16 at 04:39
  • @Jonny Henly,Thanks for the help but i got it . I wasn't importing "import org.jsoup.Jsoup" ,that's why the problem was coming.Now it's fine. – asad_hussain Mar 02 '16 at 04:43
  • Possible duplicate of [How to use classes from .jar files?](http://stackoverflow.com/questions/460364/how-to-use-classes-from-jar-files) **Note:** This isn't a negative comment. If this question is marked as a duplicate it has no negative impact on you or the question. – Jonny Henly Mar 02 '16 at 04:44
  • Explore `jsoup.jar` using any zip extractor (WinZip) and try to Findout is Document class is available in jar or not? – Vikrant Kashyap Mar 02 '16 at 05:34

1 Answers1

1

Solution found by OP:

@Jonny Henly,Thanks for the help but i got it . I wasn't importing "import org.jsoup.Jsoup" ,that's why the problem was coming.Now it's fine.

Stephan
  • 41,764
  • 65
  • 238
  • 329