Question

I'm currently working with the Tidy class from the JTidy library provided by SourceForge (http://jtidy.sourceforge.net/).

I have already added the .jar library to the CLASSPATH, and I can compile the Java program in SciTE without any error. But when I try to run the program, SciTE prints out this output:

>java -cp . SourceViewer3
Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/tidy/Tidy
    at SourceViewer3.main(SourceViewer3.java:65)
Caused by: java.lang.ClassNotFoundException: org.w3c.tidy.Tidy
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 1 more
>Exit code: 1

Note: line 65 is where I call the constructor of the Tidy class,

Tidy tidy = new Tidy();

But when I try to run the program in command prompt, it runs smoothly without any problem. How can I fix the problem in SciTE?

Additional information: I'm using Windows 7 64 bit, SciTE 3.0.3 and Java version "1.7.0_02".

Was it helpful?

Solution

Nevermind, it is solved now.

Turns out that I must run it by using the command "java (java class name)" rather than using the default command "java -cp . (java class name)" used by SciTE, so that it doesn't override the setting of the CLASSPATH environment variable.

Sorry for the bother ^^;;

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top