• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

NoClassDefFoundError

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to every one I had the java 1.6 version in my mechine


C:\>java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

I written the following simple program.

class Test
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}

I saved this in the C:\ directory. I am able to compile this successfully but when I want try to run this I am getting the following exception.

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



C:\>javac Test.java

C:\>java Test
Exception in thread "main" java.lang.NoClassDefFoundError: Test

why I am getting this Exception at run time please send me the reply if any one had idea.

Thanks in advance.
Ishmayel.

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well it is possible that your classpath variable don't have a . in it
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does your CLASSPATH look like? It most likely does not contain '.' (the current directory), as Ivan suggests. Note that if you do not set the CLASSPATH evironment variable at all, Java will automatically look in the current directory.

Since this question does not really have much to do with the SCJP exam, I am moving this to the Java in General (Beginner) forum. Please continue there.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic