We help IT Professionals succeed at work.

How do jacoZoom-generated Java-sources know where the native Library is located?

finaris
finaris asked
on
2,259 Views
Last Modified: 2013-11-23
I generated java wrapper-classes for the DLL of the "Mercury Quality Center 9.0 API" (OTAClient.dll) with JacoZoom.
By default, the wrapped DLL file is located in "c:\program files\common files\Mercury Interactive\Quality Center",
but my application should have the OTAClient.dll file in its own directory (the default path may be not accessible).

I could not find any option in JacoZoom to set the path of the wrapped DLL.
And regarding the generated java-sources, I could not find any information on how the DLL is found by the java classes.
My application only works if the OTAClient.dll file is located in the standard directory, otherwise I get Exceptions that the DLL could not be found.

Does anyone know, how JacoZoom-generated Java-sources know where the native library is located?


I attached a code snippet showing a class generated by JacoZoom.
"vtblCall()" is a method from the jacoZoom library, but it seems to me that this method gets the requested information from the DLL.
As that jacoZoom library is not generated while wrapping the native library, in my opinion, the parameters must be the key to the DLL and its method.
But  I have no idea how.

Can anyone help me?

public class IBugJCW extends com.td.TDAPIOLELib.jcw.IBaseFieldExMailJCW implements com.td.TDAPIOLELib.IBug {
  public static com.td.TDAPIOLELib.IBug getIBugFromComPtr(int comPtr,boolean bAddRef) throws com.inzoom.comjni.ComJniException { return comPtr == 0 ? null : new IBugJCW(comPtr,bAddRef); }
  public static com.td.TDAPIOLELib.IBug getIBugFromComPtr(int comPtr) throws com.inzoom.comjni.ComJniException { return comPtr == 0 ? null : new IBugJCW(comPtr); }
  public static com.td.TDAPIOLELib.IBug getIBugFromUnknown(com.inzoom.comjni.IUnknown unk) throws com.inzoom.comjni.ComJniException { return unk == null ? null : new IBugJCW(unk); }
  public static com.td.TDAPIOLELib.IBug convertComPtrToIBug(int comPtr,boolean releaseComPtr) throws com.inzoom.comjni.ComJniException { return comPtr == 0 ? null : new IBugJCW(comPtr,true,releaseComPtr); }
  protected IBugJCW(int comPtr,boolean bAddRef)throws com.inzoom.comjni.ComJniException { super(comPtr,bAddRef); }
  protected IBugJCW(int comPtr)throws com.inzoom.comjni.ComJniException { super(comPtr,com.td.TDAPIOLELib.IBug.IID); }
  protected IBugJCW(int comPtr,com.inzoom.util.Guid guid) throws com.inzoom.comjni.ComJniException { super(comPtr,guid); }
  protected IBugJCW(com.inzoom.comjni.IUnknown unk) throws com.inzoom.comjni.ComJniException{ super(unk,com.td.TDAPIOLELib.IBug.IID); }
  protected IBugJCW(com.inzoom.comjni.IUnknown unk,com.inzoom.util.Guid guid) throws com.inzoom.comjni.ComJniException { super(unk,guid); }
  protected IBugJCW(int comPtr,boolean useQI,boolean releaseComPtr)throws com.inzoom.comjni.ComJniException { super(comPtr,com.td.TDAPIOLELib.IBug.IID,releaseComPtr);}
  protected IBugJCW(int comPtr,com.inzoom.util.Guid iid,boolean releaseComPtr)throws com.inzoom.comjni.ComJniException { super(comPtr,iid,releaseComPtr); }
  public java.lang.String getStatus() throws com.inzoom.comjni.ComJniException {
   java.lang.String rv = (java.lang.String)null;
    com.inzoom.comjni.Variant[] _v = new com.inzoom.comjni.Variant[]{
     new com.inzoom.comjni.Variant(rv,com.inzoom.comjni.enums.VarType.BSTR,true)    };
    vtblCall(96,_v,com.td.TDAPIOLELib.IBug.IID);
   rv=_v[0].getString();
    for(int i = 0; i < _v.length; i++) _v[i].release();
    return rv;
  }
  public void setStatus(java.lang.String pVal) throws com.inzoom.comjni.ComJniException {
    com.inzoom.comjni.Variant[] _v = new com.inzoom.comjni.Variant[]{
     new com.inzoom.comjni.Variant(pVal,com.inzoom.comjni.enums.VarType.BSTR,false)
    };
    vtblCall(100,_v,com.td.TDAPIOLELib.IBug.IID);
       for(int i = 0; i < _v.length; i++) _v[i].release();
  }

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
dll's are loaded by System load calls (usuully done from a static block).
You can either specify the location, or it searches the PATH.
Putting them in the same directory as you run it from is usually the easiest.

Author

Commented:
Changing the java.library.path did not work, and the default path of the dll is not included either.
But as mentioned above, it al works fine is the DLL is in Quality Center's default directory, I just cannot put it into another directory (that is what i need to do) and run my code.

Regarding System load calls, i did not find any of them in the generated sources, and i still got no idea why the classes look for the wrapped DLL in "c:\program files\common files\Mercury Interactive\Quality Center", and not anywhere else.
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.