I've created abc.java file in c:\sun\appserver\jdk\bin.
I've made this my current directory.
I compile by typing at the prompt javac abc.java.
It compiles.
Next i type java abc
I get this error: EXception in thread "main"
java.lang.NoClassDefFoundError: ABC/class
Why does this happen?
My source code is:
class ABC
{
public static void main(String args[])
{
System.out.println("This is the output");
}
}
> Next i type java abc
> I get this error: EXception in thread "main"
> java.lang.NoClassDefFoundError: ABC/class
You didn't type "java abc". Instead, you typed "java ABC.class".
Neither is correct. You should have typed "java ABC".
In the future, it will probably be easier to help you with your problems
if you don't lie about them.

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
> I've created abc.java file in c:\sun\appserver\jdk\bin.
You shouldn't story your own code in the java bin directory.
Since you're obviously new to Java, I suggest starting with J2SE, not the
Sun application server.
http://java.sun.com/j2se/1.5.0/download.jsp
pick the "JDK 5.0" download
> I've made this my current directory.
> I compile by typing at the prompt javac abc.java.
> It compiles.
Java is case sensitive. public class ABC must be stored in file
ABC.java, not abc.java. This only compiles because you didn't make class
ABC public.
> Next i type java abc
> I get this error: EXception in thread "main"
> java.lang.NoClassDefFoundError: ABC/class
> Why does this happen?
First have a look at what Chris said.
This happens because there is no class called "class" in package "ABC".
Instead, there is a (non-public) class called "ABC".
> My source code is:
>
> class ABC
use public class ABC instead
> {
> public static void main(String args[])
> {
> System.out.println("This is the output");
> }
> }

Signature
Beware the False Authority Syndrome