Using dll Library in java application using jacob illuststrate using dll libraries in java application
Posted 09 February 2010 - 09:52 PM
i have found solution to this problem..
for your knowledge ,let me explain
in jacob package ,,there are two things(jacob.jar and jacob.dll) causing problems if they are misplaced. The jacob.jar loads the jacob.dll.
when in new process ,the jacob.jar reference the jacob.dll than in that procees the jacob.dll loaded once. in that process next call to load jacob.dll will not load the jacob.dll again but will not do loading because in one process the same class loader will not load the same dll.
where as in servlet issue . for each servlet there may be different classloaders in one process . diffrent classloaders loadind same dll may cause problem..
and solution is ,to use single classloder to load class loading the jacob.dll.
thus perticulary for tomcat 6.0. In netbeans make javaclasslibrary project that has access to jacob.jar that loads the jacob.dll .place this(javaclasslibrary.jar) in C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib folder.(completely deploy including dist folder).
now no need to add reference of jacob.jar in your servlet project because your javalibary.jar refered by tomcat 6.0.
thus directly use your javalibary.jar to acceess jacob.jar from your servlet project, so as every time classes in javalibary.jar are loaded by same classloader of tomcat6.0. and therefore for each servlet ,jacob.dll is loaded only once.
my motto is truth works. God bless you all.
Posted 23 April 2010 - 05:32 AM
One more question...
I hope this post relates to the subject of this forum...
I use the JAVA language and I call a method that returns its answer by 'by reference'.
For example (I use your example) -
int multiplication = Dispatch.call(comp,"multi",arg1,arg2)
the method "multi" receives 2 parameters - arg1 and arg2 and its return value is in multiplication variable.
Suppose the method "multi" puts its return value in arg2.
Meaning the arg2 I sent the method "multi" was sent by reference. Do u know how I retrieve the return value from arg2???
Because, in my problem, the argument arg2's value stays as it was before I sent it to "multi". The answer "multi" calculated, is not in arg2..
Posted 19 December 2012 - 03:01 PM
I appreciate your work here. I am working on accessing a vb.NET class into java using Jacob library. I am able to run your example project successfully. I tried to create a dll using the link you provided but when I tried to register I have no errors but when I tried to load the dll in my java its giving me an error "Can't get object clsid from progid".
I am wondering if I am missing anything in calling or in creating a dll. your dll name is Com.dll and why do you load Com.Calculation in java is Calculation a class name in the dll file?
If possible can you provide your vb code as well.
This post has been edited by modi123_1: 19 December 2012 - 03:04 PM
Reason for edit:: removed excessive quote