Re: Is there a JNI Mailing list? [john.boyer@xxxxxxxxxxxxxxxxx: Telling Java where to find a native library]

  • From: "John J. Boyer" <john.boyer@xxxxxxxxxxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Tue, 24 Aug 2010 07:27:43 -0500

Thanks. I do alkready have the C code for the bindings. I'll try some 
things for compiling it as a shared library. I've looked an JNA, but I'm 
a C guy, so I wanted to give JNI a shot. Thre BrailleBlaster application 
has several other C libraries, so JNA might be the best choice in the 
long run.

John

On Tue, Aug 24, 2010 at 02:00:41PM +0200, QuentinC wrote:
>    > I may switch to the Sun JDK at some point, but right now i just want to
>    get the bindings to load the library, so I can proceed with testing.
>    These bindings will be used with other jdk's, inncluding Eclipse.  Prrefer
>    to work in a command-line environment.
>    Eclipse is not a JDK but an IDE.
> 
>    I'm sure you will have much less problems if you switch immediately to the
>    official sun JDK.
>    For example on debian and ubuntu , OpenJDK is really a pain. There are
>    many topics about various java problems on a french forum I regularely go,
>    and they are solved by magic just after they switch without doing anything
>    else.
> 
>    > The C part of the bindings includes jni.h Will this take care of the
>    necesary entry poiints for Java?
> 
>    If the developper has included jni.h and exported functions whose names
>    start with java, yes, it's read for use by java. You have to compile it as
>    a shared library.
>    I had a complete compilation procedure for windows using MinGW, hopes that
>    helps. I have infortunately never done JNI outside of windows, so I don't
>    know if it works for other systems.
>    1 - Compile java class
>    2 - generate C header using javah on the compiled java class
>    3 - Code C functions using the generated header at step 2
>    4 - Make a .def file listing all exported functions
>    5 - Compile C source => gcc -o file.o file.c
>    6 - Compile shared library => gcc -shared -o file.dll file.def file.c
>    I think you can try to start at step 4, if somebody gave you the source of
>    a java compatible library.
> 
>    Just a note : I personally don't use JNI anymore. You may look at JNA,
>    which is much easier in case you haven't already a wrapper.
> 

-- 
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: