Can you try an unmodified JPopupMenu?
> CtClass cc = pool.get(name);
> byte b = cc.toBytecode();
> Class c = defineClass(name, b, 0, b.length);
> return c;
This simply loads JPopupMenu as is. If an exception
is still thrown, the problem is because JPopupMenu
is loaded by a class loader different from one loading
prohibits JPopupMenu from accessing package
methods in SwingUtilities.
Please read Section 4 of the tutorial.
As is stated in javassist.Loader:
/* The swing components must be loaded by a system
* class loader.
* javax.swing.UIManager loads a (concrete) subclass
* of LookAndFeel by a system class loader and cast
* an instance of the class to LookAndFeel for
* (maybe) a security reason. To avoid failure of
* type conversion, LookAndFeel must not be loaded
* by this class loader.
I cannot do what I want...
The only think I could do is instrument the compiled
class and then use : java -Xbootclasspath