Do you compile it also from the command line? If you do so, what is your instruction to compile?
-----Original Message----- From: java-ee-j2ee-programming-with-passion@googlegroups.com [mailto:java-ee-j2ee-programming-with-pass...@googlegroups.com] On Behalf Of M M Sent: Martes, 20 de Octubre de 2009 10:45 a.m. To: Java EE (J2EE) Programming with Passion! Subject: [java ee programming] Packages in Java...Need your help 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 -~----------~----~----~----~------~----~------~--~---