java.lang.NoClassDefFoundError on OSGi

John John Pichler picture John John Pichler · Mar 3, 2011 · Viewed 12.3k times · Source

I have a bundle, with an activator declared. This activator create a JFrame and show it.

Running on Eclipse as Plugin project it works fine. When I put on Felix it doesn't work anymore. It shows: java.lang.NoClassDefFoundError: com/griep/ui/MainFrame

But MainFrame is located in the same bundle the activator is, as a public class, of course. I don't understand why the classloader isn't finding the class.

Anyone knows what is happening?

Answer

Neil Bartlett picture Neil Bartlett · Mar 3, 2011

Make sure you import the javax.swing package into your bundle:

Import-Package: javax.swing