I need to create an Applet that can load a com method, for this purpose I used the java com bridge (jacob) deal with the com dll, and My Environment is set as follow:

  • os:win7x64
  • IDE:Eclipse32bit-version
  • COM DLL:BPIKeyCOM.dll 32-bit version
  • com bridge : jacob1.17-32bit version
  • server: Tomcatv7.0

I put jacob.dll under C:\Windows\System32 and jacob.jar under WEB-INF\lib

When I run the project, it's working fine in Eclipse. But when deployed on the web, the following error messages appear:

java.lang.NoClassDefFoundError: com/jacob/activeX/ActiveXComponent
at Fmain.Ikeycheck(Fmain.java:180)
at Fmain.init(Fmain.java:73)
at sun.applet.AppletPanel.run(AppletPanel.java:435)
at java.lang.Thread.run(Thread.java:724)

Caused by:
java.lang.ClassNotFoundException: com.jacob.activeX.ActiveXComponent
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:219)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:152)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)...

It looks like this message is talking about that it can't find com/jacob/activeX/ActiveXComponent.class, but I don't understand how.

I've already searched for many solutions and tried to solve it, but it still keeps showing this error message, I use to do sigh jar, make sure the classpath is correct, and even try to change the policy file...etc. But still, it's not working!

2

There are 2 answers

2
Elliott Frisch On BEST ANSWER

You've installed the dll and jacob.jar into your Java Web container; unfortunately, that is not the user's web browser (e.g. Applet Container). You need to add the dll and jacob.jar file into the applet jar. You should probably also read this. It's also important to point out that if your users install a 64-bit jdk, or aren't running Windows - then your Applet will not work.

0
Lonzak On

Have a look at the example provided with jacob:

e.g. jacob-1.17_src.zip\jacob-1.17\samples\com\jacob\samples\applet

This is a nice example how it works - it even has a readme.txt with a full description inside...