I have a java file named hello.java which is given below:-

package haaa;
class hello
{
        public static void main(String [] args)
        {
                System.out.println("Hello");
        }
}


I am using Windows XP. In my system, CLASSPATH is set to "E:\workspace
\pkg\src". Initially, the file is present in the folder "E:\workspace
\pkg\src\". When I tried to compile it, there was no error. But when I
tried to execute the command,

java haaa.hello

then it returned an error like this:-

Exception in thread "main" java.lang.NoClassDefFoundError: haaa/hello

Caused by: java.lang.ClassNotFoundException: haaa.hello
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: haaa.hello.  Program will exit.

Could you please help me correct the error.

Also, my system has a Linux OS. In Linux OS, whenever I compile and
execute java programs in Eclipse IDE, then it goes smoothly. But when
I try to compile in terminal using javac command then it tells that
"no such command found". For setting PATH variable in Linux, I need to
know where javac file is located. But I searched everywhere in Linux
using File Search facility. So, why is there a difference between
Eclipse IDE and terminal? I need your help desperately.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to