[fedora-java] Linking to libjava.so

Thomas Fitzsimmons fitzsim at redhat.com
Fri Sep 21 18:29:35 UTC 2007


Orion Poplawski wrote:
> I'm trying to package up a java package for octave that links to 
> libjava.so.  Problem I'm having is that when octave tries to load the 
> module at run time it can't find libjava.so.  How should this be remedied?

__java__.oct requires JNI_CreateJavaVM which is defined in libjvm.so.  libjvm.so 
is designed to be dlopened, rather than linked-to directly and loaded from 
LD_LIBRARY_PATH.  So in __java__.cc:initialize_jvm, modify the Unix branch of 
the __WIN32__ ifdef to dlopen /usr/lib/jvm/jre/lib/$arch/client/libjvm.so and 
locate JNI_CreateJavaVM using dlsym.  You can probably re-use the octave_shlib 
code from the win32 branch after jvm_lib_path initialization.  $arch can be 
discovered and substituted by configure.

Tom




More information about the java-devel mailing list