File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Exception in thread "main" java.lang.NoClassDefFoundError: TestConWindow" Watch "Exception in thread "main" java.lang.NoClassDefFoundError: TestConWindow" New topic
Author

Exception in thread "main" java.lang.NoClassDefFoundError: TestConWindow

Joel Cochran
Ranch Hand

Joined: Mar 23, 2001
Posts: 301
Exception in thread "main" java.lang.NoClassDefFoundError: TestConWindow
Uggghhhh! This program worked fine until today!!! It must be a Classpath thing, but I can't figure it out. The class compiles fine but then receives this error when I try to execute. Could this message be any LESS helpful?
Here is the code. The 'User' class is in the same directory as the TestConWindow.class ... I had a classpath problem with this last week which I got around by compiling with -classpath. That is the only way I could get the program to compile and adding .; to my classpath does not work.

Thanks if anyone can help.
Pulling my hair out...
------------------
I'm a soldier in the NetScape Wars...
Joel


Wait a minute, I'm trying to think of something clever to say...<p>Joel
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Joel,

In your code, you are specifying that your TestConWindow is in the camra2 package... if you are in the same directory as the class file, try running it this way :


You have to specify the directory directly before the beginning of your package in the classpath, and if a class is a member of a package, you have to specify it's full name (i.e. full package path + class name) on the command line.

HTH,
-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Joel Cochran
Ranch Hand

Joined: Mar 23, 2001
Posts: 301
I've removed the package reference. Both Classes are in the same directory. They both compiled fine. My classpath includes the current directory. I tried running the program without -classpath and with -classpath. No matter what I receive the same error:

I don't know what else to do, I don't see anything wrong with the code (same as above w/o package statement), "main" obviously exists, I'm not running the program with ".java" extension, my classpath is set and complete.
Going bald...
------------------
I'm a soldier in the NetScape Wars...
Joel
navin kumar
Greenhorn

Joined: May 22, 2001
Posts: 9
Hello,
U first set the classpath in environment file i.e.
"autoexec.bat" file. there set as follows
classpath=c:\jdk1.3\<package name>

If further more doubts regarding this U can post here
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

I'm really confused about this one...

I've been trying to test your code and there doesn't look like there should be any problem... the only suggestion I can make is to check out the logic in the Class.forName related stuff... in the spoofed User class I made to test your code, if I was returning bogus info ( i.e. a class that did not exist ), I got a similiar error message... strangely, you should not get that error message if you were making the same mistake I was, because the TestConWindow class obviously exists....

Sorry I couldn't help more...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception in thread "main" java.lang.NoClassDefFoundError: TestConWindow