NoClassDefFoundError

I am trying to run the program below...I can compile it as long as i specify the classpath to the jar file that contains the class that references the import statement below.

But after it complies and i try to run it, I get the NoClassDefFoundError. And I can't figure out what I am doing wrong:

I compile using javac -classpath "/to/my/jars/reg.jar" doRenameIt.java

then try to run it using: java doRenameIt...and that's when I get my error

import gov.doc.getFile.util.DirectIO;

public class doRenameIt

{

public static void main (String [] args) throws Exception

{

DirectIO dio = new DirectIO("testfile.txt", "/mount/dir", "id", "/");

dio.makeVisible();

System.out.println("Now you see the file.");

}

}

[793 byte] By [The_Real_E.T.a] at [2007-11-27 1:14:20]
# 1
You have to specify that JAR file that contains the class in the import statement, not only in the classpath when compiling, but also in the classpath when executing your class file as well.
maple_shafta at 2007-7-11 23:49:41 > top of Java-index,Java Essentials,Java Programming...
# 2
Ok, so my should import statement say:import gov.doc.getFile.util.DirectIO;import reg.jar- then compile with javac -classpath "path/to/my/jars/reg.jar" doRenameIt.java- and then run the program with java -classpath "path/to/my/jars/reg.jar" doRenameIt
The_Real_E.T.a at 2007-7-11 23:49:41 > top of Java-index,Java Essentials,Java Programming...
# 3
Yes that should work.
maple_shafta at 2007-7-11 23:49:41 > top of Java-index,Java Essentials,Java Programming...