ParserException error (newbie question)
Andreas Kring <[email protected]>
| Newsgroups | gmane.comp.parsers.htmlparser.user |
|---|---|
| Message-ID | <[email protected]> |
Hello all.
I have a newbie question that I hope you can help me with:
I'm using Ubuntu 10.04 and I have just installed the package
libhtmlparser-java. I get no errors when compiling the code below
(test_htmlparser.java) using the command
$ javac -classpath /usr/share/java/libhtmlparser.jar test_htmlparser.java
but when I try to run the program, I get the following error:
$ java test_htmlparser
Exception in thread "main" java.lang.NoClassDefFoundError:
org/htmlparser/util/ParserException
at test_htmlparser.main(test_htmlparser.java:12)
Caused by: java.lang.ClassNotFoundException:
org.htmlparser.util.ParserException
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 1 more
What can I do to fix this?
/Andreas
----- test_htmlparser.java begin -----
import org.htmlparser.*;
import org.htmlparser.util.*;
class test_htmlparser
{
public static void main(String[] args)
{
try {
Parser parser = new Parser("http://www.sslug.dk");
} catch (ParserException e) {
System.err.println("Caught ParserException: " + e.getMessage());
}
}
}
----- test_htmlparser.java end -----
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl