| Author |
No Class DefFoundError
|
Lalit Nagalkar
Ranch Hand
Joined: Aug 22, 2006
Posts: 47
|
|
Hello every one I am getting this exception when running any standalone application as simple as HelloWorld it compiles correctly and I am in the same directory as the class. the class is not in any package it has started giving this error just recently earlier it never happened. I dont know whats wrong. Exception in thread "main" java.lang.NoClassDefFoundError: hello please help Thanks lalit
|
SCJP 1.4
|
 |
Katrina Owen
Sheriff
Joined: Nov 03, 2006
Posts: 1336
|
|
Hi Lalit, It looks like the kind of error that I get when I misspell the name of the class when running the application. In my case, the two most common causes are 1) I forgot to rename the class that contains the main() method, after renaming the file: Here, if I compile MyApp.java and then attempt to run the program, I get If I try to run a program called Test (look at the name of my class), then the program will run successfully, even though I do not have a file called Test.java 2) I misspell the name of the program The lowercase 'm' in 'myApp' (rather than capital 'M' of 'MyApp') was enough to cause an error. Katrina [ March 12, 2007: Message edited by: Katrina Owen ]
|
 |
Lalit Nagalkar
Ranch Hand
Joined: Aug 22, 2006
Posts: 47
|
|
Hello Katrina, Your point is right, but I am not using different file name and different class name as my class is public. its the simplest app -------- public class HelloWorld {public static void main(String ar[]) {System.out.println("hello there"); } } -------- I am not a novice to Java(to some extent) and have run many other advanced programs, never getting such error. I am not getting why , I tried reinstalling the jdk1.5.0 and all. But still its happening.. The jboss j2ee server, ant etc runs just fine, "YES ONE THING" when apache server is run using java command through its settings it too doesnt run, it runs using "jvm". Pleaze help someone thanks lalit
|
 |
Katrina Owen
Sheriff
Joined: Nov 03, 2006
Posts: 1336
|
|
Have you tried changing the parameter to main to args? It might affect this. Another issue: Are you running this from the command line? Or are you trying to run it via an application server? If it is the latter, the server might not be able to see your code.
|
 |
 |
|
|
subject: No Class DefFoundError
|
|
|