aspose file tools*
The moose likes Beginning Java and the fly likes NoClassDefFoundEroor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NoClassDefFoundEroor" Watch "NoClassDefFoundEroor" New topic
Author

NoClassDefFoundEroor

Himal Chuli
Ranch Hand

Joined: Aug 06, 2002
Posts: 118
hi,
i've the following class:
public class Test{
public static void main(String[] args){
System.out.println("Hello World!");
}
}
compiles fine when compiled as following:
javac Test.java
and creates a Test.class
but when done as follows:
java Test
gives me following:
Exception in thread "main" java.lang.NoClassDefFoundError: Test
what does it mean? could anyone please point it out? thanks.
himal


Himal
Haakon Lind
Greenhorn

Joined: Sep 18, 2002
Posts: 22
Hi all, what a great forum about java I found, I`ll settle in here for some years.
Ok, Himal.
From beginner to beginner I think you just missed the:
import javax.swing.* ;
bit, must allways have that class you know.
Himal Chuli
Ranch Hand

Joined: Aug 06, 2002
Posts: 118
haakon,
i don't see any reason why do i need
import javax.swing.* ;

coz i am not using any swing components at all.
if that's what caused my problem, it would not get compiled in the first place and create the "Test.class" so i don't think what you suggested is a valid cause. however, thanks for the reply.
himal
Jeelani Sk
Greenhorn

Joined: Sep 11, 2002
Posts: 4
There is absolutely no problem with the code.
The only reason is you may be running the 'java' command from a different directory. so either run it from the directory where the Test.class file resides, or make an entry of its path in the system class path to run it from any where.
Jeelani
[ September 18, 2002: Message edited by: Jeelani Sk ]
Haakon Lind
Greenhorn

Joined: Sep 18, 2002
Posts: 22
sorry , nothing wrong with your code anyway, works fine on my pc.
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
This looks like a classpath problem...
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
Himal,
Trying adding the current directory "." to your classpath as JVM looks for class files in the CLASSPATH.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NoClassDefFoundEroor