LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   i get the error "Exception in thread "main" java.lang.NoClassDefFoundError: Hello"... (https://www.linuxquestions.org/questions/programming-9/i-get-the-error-exception-in-thread-main-java-lang-noclassdeffounderror-hello-912928/)

maheshbaria99 11-10-2011 11:20 PM

i get the error "Exception in thread "main" java.lang.NoClassDefFoundError: Hello"...
 
i get the error "Exception in thread "main" java.lang.NoClassDefFoundError: Hello"...give me suggestion how to solve this problem
public class Hello
{
public static void main(String args[])
{
System.out.println("Hello world");
}
}

Nylex 11-11-2011 02:47 AM

First of all, when posting code here, you should put it between [code] and [/code] to preserve indentation and aid readability.

Also, your thread should be in the Programming forum, so I've reported it for moving there.

Have you compiled the code with javac? If so, are you in the same directory in which Hello.class resides? If not, you should be able to give the argument -cp (or -classpath) and give the path to the directory containing Hello.class. I think you can also set the CLASSPATH environment variable.

Tinkster 11-13-2011 03:13 PM

Moved: This thread is more suitable in <PROGRAMMING> and has been moved accordingly to help your thread/question get the exposure it deserves.


All times are GMT -5. The time now is 03:32 AM.