Exception in thread “main” Java Lang. NoClassDefFoundError: mainly in eclipse on OSX 10.6
When I tried to run a simple hello world application in eclipse, I got
Exception in thread "main" java.lang.NoClassDefFoundError: Main Caused by: java.lang.ClassNotFoundException: Main at java.net.urlclassloader$1.run(urlclassloader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.urlclassloader.findClass(urlclassloader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
I have compiled my class using the javac tool installed on this computer, and there is no problem running it This leads me to believe that it should be used with the JDK installed on this computer I am running OSX 10.6, eclipse indigo Sr2, and I have installed 1.6 0 JDK, which is obviously the OSX standard The build path points to the correct location for this JDK
I also tested it in Xcode, and it has no problem I still prefer to use eclipse as ide scince. I am working in parallel with the team developing Windows Applications (I have to make some small adjustments to the application to solve some dependency problems on OSX) and they use eclipse This is what I'm used to. When you have to work in the operating system you've been using for only two days, some familiarity is good: - D
How can I solve this problem? Thank you for your help!
Solution
I had the same question just now Thank you for your comment on @ Frank vanbever. I found that "run" is no longer configured to "run as an Android Application" I don't know why, I don't remember changing these parameters recently... The menu "run > run as > Android Application" works You made me feel good all day: -)