dcsimg
BeanBox cannot load a native method jar?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Xu_ch
Posted On:   Wednesday, July 24, 2002 03:16 AM

I wrote a test bean which calls a native method written by C.It's very simple,just print a message.It works fine when I run it by " java myclassname" under command line (OS is Windows). now I archived this bean in a jar file.What I put into it was myclass file ,relevant dll file and a manifest file. now I load it in beanbox,the bean's name can be show in toolbox, but when the name is clicked an exception occured,the error massage was: D:home eans eanbox>java sun.beanbox.BeanBoxFrame WARNING: Could not instantiate bean "myjni" from JAR "D: mpccodeJar1 ad.jar" We located the class "myjni" OK The class provides    More>>

I wrote a test bean which calls a native method written by C.It's very simple,just print a message.It works fine when I run it by " java myclassname" under command line (OS is Windows).
now I archived this bean in a jar file.What I put into it was myclass file ,relevant dll file and a manifest file.
now I load it in beanbox,the bean's name can be show in toolbox,
but when the name is clicked an exception occured,the error massage was:






D:home eans eanbox>java sun.beanbox.BeanBoxFrame



WARNING: Could not instantiate bean "myjni" from
JAR "D: mpccodeJar1 ad.jar"

We located the class "myjni" OK


The class provides a public zero-arg constructor

But were unable to create an instance of the class because we
got an exception while doing Class.newInstance() :
java.lang.NoClassDefFoundError
The stack backtrace at the time of this exception is
java.lang.NoClassDefFoundError
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at sun.beanbox.JarInfo.diagnoseInstantiationException(JarInfo.java:308)
at sun.beanbox.JarInfo.getInstance(JarInfo.java:155)
at sun.beanbox.ToolBoxPanel.mousePressed(ToolBox.java:354)
at java.awt.Component.processMouseEvent(Component.java:3714)
at java.awt.Component.processEvent(Component.java:3546)
at java.awt.Container.processEvent(Container.java:1164)
at java.awt.Component.dispatchEventImpl(Component.java:2595)
at java.awt.Container.dispatchEventImpl(Container.java:1213)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:10
3)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)




I'm sure the format of the jar is ok, and dll file was in it,why it says "java.lang.NoClassDefFoundError
at java.lang.Class.newInstance0(Native Method)
"?

   <<Less
About | Sitemap | Contact