-2

I'm encountering the error shown below. I can't understand what it says.

jframe name is "MainHome". project name is palathuru

java.lang.NoClassDefFoundError: palathuru/MainHome
Caused by: java.lang.ClassNotFoundException: palathuru.MainHome
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: palathuru.MainHome.  Program will exit.
Exception in thread "main" Java Result: 1

Can someone help me?

Mark J. Bobak
  • 13,720
  • 6
  • 39
  • 67
Pasi
  • 11
  • 2
  • @user3133778 - you're getting a lot of unhelpful answers :). Q: What does this error `java.lang.NoClassDefFoundError: palathuru/MainHome` mean? A: Java is expecting to find a "public class MainHome" in package "palathuru". You should also have a folder "palathuru\". Look at this link: http://stackoverflow.com/questions/17973970/how-to-solve-java-lang-noclassdeffounderror – paulsm4 Dec 25 '13 at 04:06
  • 1
    And why URLClassLoader? Describe running architecture of your application. Is it an applet? – Amir Pashazadeh Dec 25 '13 at 04:22
  • please post the relevant code. – Visruth Dec 25 '13 at 07:50

2 Answers2

0

You are missing a package declaration in class MainHome include:

package palethuru;

at the top of MainHome.java and it should work

Michael Yaworski
  • 13,410
  • 19
  • 69
  • 97
Emmanuel John
  • 2,296
  • 1
  • 23
  • 30
  • It is there. I can't imagine what happened..suddenly something happened. don't know how to explain.. every points I set a sout. can't find the place that error occur.. – Pasi Dec 25 '13 at 04:32
  • How are you compiling? Command line or IDE? – Emmanuel John Dec 25 '13 at 04:34
  • If you are using command line make sure you are compiling like this: javac palethuru/MainHome.java – Emmanuel John Dec 25 '13 at 04:40
  • IDE.. I kept a copy of project file before a week. there are 4 tabs in the frame.. I replace that copied project by another name to the C:\Users\MAXX\Documents\NetBeansProjects.. And replace(refactored) tabs to copied projects from the error project.. Then It is finely working.. Thank you for helping me..Thanks alot. Don't know what happened to it before. Just gave a clean and build and error occured.. Now I refactoring items to old one.. thank youuu – Pasi Dec 25 '13 at 04:42
  • But didn't refactored all items.. Perhaps I have to meet it again. If I get the error again,I can describe something more better than this. thank you.. – Pasi Dec 25 '13 at 04:45
0

I don't have reputation to comment up above. If declaring the package name:

package palethuru;

at the top of MainHome.java doesn't help you then you should be more specifie. There can be any reason for not finding the class.. But you're problem looks like you're missing the package name in MainHome.java

Thunder
  • 165
  • 1
  • 2
  • 12