Reputation: 289
I downloaded Jsoup and am trying to access the classes in the jar file. How can I do this? I'm using OSX. I downloaded the jsoup jar to the same directory my class is in and my include path includes ".".
Upvotes: 0
Views: 717
Reputation: 68942
In your source you import the classes during compile time using import statements like
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
during runtime the classes will be loaded by the VM. (Both requires the jar file in your CLASSPATH
).
Most of the API examples omited the imports since modern IDEs insert them for you.
Upvotes: 1
Reputation: 3027
It depends of the level of the JRE you are using, but you typically need to actually add the jar file name to the classpath, not just the directory. So use java -cp /path/to/jsoup.jar MyClass
Upvotes: 0