Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netbeans NoClassDefFoundError

Tags:

netbeans

I have a recurring bug when attempting to run Netbeans (7.2), last time I had it, I found somewhere that you can just move all your files to a new project. That will probably work, but the size of my project makes that quite a hassle. Here is the trace...

Exception in thread "main" java.lang.NoClassDefFoundError:  X.X.X.X
Caused by: java.lang.ClassNotFoundException: X.X.X.X
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    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: X.X.X.X Program will exit.

It's definitely there, it was fine 10 minutes ago and I haven't touched it.

I'm pretty sure it has something to with the automatic compiling (and perhaps code-completion features) of netbeans. Is there a way I can just reset all the internal data without moving everything to a new project. Or any other suggestions.

like image 656
Lucas Avatar asked Jan 21 '26 18:01

Lucas


2 Answers

There is one Single and easy way to do it. make your compiler to compile that Program again. means just change some code like Put somecode Or print Something in between and Save it again.

and Clean and Build Project. that will happen

Right Click On Project --> Clean and Build.

and Run that Program Again.

Here we go enjoy. that would be solved.

in short you need to make some change so that compiler needs to compile that program again. so that error will be slolved.

and its not coding mistake i think problem is with IDE.

like image 190
Kishan Bheemajiyani Avatar answered Jan 24 '26 03:01

Kishan Bheemajiyani


In cases described, it usually helps me to delete whole cache of Netbeans.
So close Netbeans.
Locate directory with netbeans cache and delete its content.
It's usually located in [USER_HOME]\.netbeans\7.x\var - delete everything in var directory.

like image 26
Ondrej Bozek Avatar answered Jan 24 '26 02:01

Ondrej Bozek