B4J Question Access to 3rd party libs with jna?

Patent

Member
Licensed User
Longtime User
Dear community,

need some info about access to ext. libs in B4J:

For example a ext.lib in .jar format calls internal some methods of a native Win .dll (with jna).

(no b4j wrapper existing).

I'am doing the following:
-Storing the lib in the ext.libs folder.
-In the B4J IDE i include the lib in the #Region Project Attributes with #AdditionalJar: thelibrary
-I'am calling some methods with a JavaObject and InitializeNewInstance, and RunMethod....and so on.

The questions are:
a)where should i store the jna.jar lib? Should i add a reference in the #AdditionalJar Section?
b)where do store the .dll?
c) does this work in general with B4J or is it impossible to access such a lib?

Thanks for advice
patent
 

Patent

Member
Licensed User
Longtime User
thank you, erel.
if the Idea is: let us call a dll xy then your link is the way to go, i think. (not mine! too Stony ;-) )

i asked about libs which are allready ready for the use in pure Java and doing their calls to JNA and dlls.
so a Java wrapper is still done i think.
For example the jvlc.jar


greets
 
Upvote 0

Daestrum

Well-Known Member
Licensed User
Longtime User
If the java library uses the underlying platform ( windows for example ) then they normally will contain the dll within the jar file (in fact nice ones will include them for all platforms they are capable of running on). A simple check on which operating system they are running on and they can then use the correct file.

This gives the advantage of
a) They will use the system specific file they were compiled against, even if the system has a different version installed.
b) Using them from another java program, you won't need to worry about obtaining the files they rely on, they will be there.

If you have access to the api docs for the library/class , they can be accessed through javaobject, without the need for a wrapper.
 
Upvote 0

Patent

Member
Licensed User
Longtime User
i am working with the vlcj.jar lib (videolan project),there are methods in to find the ext. dlls which are called through JNA.
therefore my question about where to save and what to reference in b4j.
but i am on the right way......
thanks
 
Upvote 0
Top