English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I set my systems path and also previously my java programs runs but now when I compile Java program e.g. javac Hello.java, it compiles and creates Hello.class file, but when I run e.g. java Hello, it shows the error i.e. Exception in thread "main" java.lang.NoClassDefFoundError? Why? Please tell me as early as possible.

2006-11-01 18:06:15 · 5 answers · asked by mudholkar_pankaj 1 in Computers & Internet Programming & Design

5 answers

Hai pankaj,
I think the problem must be in the compilation unit(i.e, the source code).
Please check that your main function is syntactically correct.
or
Check it with the code below.

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

good luck.

2006-11-01 19:23:29 · answer #1 · answered by Anand 3 · 3 0

NoClassDefFoundError means that the not found class WAS there when you compiled your source, but is no longer on the classpath at runtime.

You need to make sure that when you run your application the "not found" class is on the classpath.

If its a main app, you would probably execute a command similar to:

java -classpath /filesforapp:/jarsperhaps Hello

Good luck! :^)

2006-11-01 22:55:36 · answer #2 · answered by Liggy 2 · 0 0

A Thought? It's Kim kardashian!

2016-05-23 12:16:04 · answer #3 · answered by Lauren 3 · 0 0

u forgot to set the classpath or u did not do it properly.
there is no other problem !!

2006-11-05 16:34:34 · answer #4 · answered by srihari_reddy_s 6 · 0 0

Did you import the java.lang class that you need?

2006-11-01 18:14:16 · answer #5 · answered by h2gj87 4 · 0 1

fedest.com, questions and answers