How do jacoZoom-generated Java-sources know where the native Library is located?
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(); }
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.
finaris
ASKER
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.
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.