Leo Izen
Leo Izen

Reputation: 4289

NetBeans isn't finding my class

Netbeans is returning a NoClassDefFoundError, but my class is right there! Has this happened to anyone before? PROBLEM SOLVED: I had a bad annotation in front of my class, so the runtime didn't pick it up.

run:
java.lang.NoClassDefFoundError: targzipmanager/TarGzipManagerView
Caused by: java.lang.ClassNotFoundException: targzipmanager.TarGzipManagerView
        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:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: targzipmanager.TarGzipManagerApp.  Program will exit.
Exception in thread "main" Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

Upvotes: 1

Views: 4008

Answers (2)

Avall
Avall

Reputation: 870

Is it compiling in the code editor, but not when you run (compile with ant) your project?!

  • The package for class TarGzipManagerView is not visible outside its module: Right click the module and choose Properties, in the list to the right, choose (I think) "Public API" and make sure all or at least the package targzipmanager is checked.

Does this happen in runtime?!

  • If you're using reflection to access the class TarGzipManagerView, it could be the wrong class loader, make sure to use Thread.currentThread().getClassLoader().

Upvotes: 0

duffymo
duffymo

Reputation: 308753

You haven't set CLASSPATH to NetBeans' satisfaction. Here's how to do it.

Upvotes: 1

Related Questions