I have a project I've been developing in Eclipse 3.7.2 on Ubuntu 12.04. Recently, I've restructured the class hierarchy which involved moving classes between packages. I did not move my main class ("ob3.converter.Converter"), which contains my public static void main(String[] args)
method.
Now, when I attempt to run it, I get:
Exception in thread "main" java.lang.NoClassDefFoundError: ob3/converter/Converter
Caused by: java.lang.ClassNotFoundException: ob3.converter.Converter
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: ob3.converter.Converter. Program will exit.
I've only ever really worked (in java) with Eclipse, which handles all the overhead for me - hence I have little understanding of this error or what could cause it. I've looked through my Run Configuration/Classpath etc but without knowing what to look for, it was fruitless.
Could anybody point me in the right direction? I've googled / search SO, and most things talk about a manifest file, but I've been unable to find it anywhere. My workspace folder contains nothing more than my source files.
I can verify:
public static void main(String[] args)
method.Any help is very much appreciated!
I think you should rebuild your project. You can do this by clicking on Projects > Clean...
Sometimes the automatic build of Eclipse has problems with the refactoring or moving of classes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With