Converting a .so file to a .jnilib file

I have a library .so

compiled for Linux in ELF format that is used by a Java program. I'm trying to move this application on Mac OS X, and found that OS X uses a different extension for these files .jnilib

. I already figured out how to set it up PATH

so that it finds the files correctly. However OS X Java is unable to download files .so

(as it expects a different extension).

If I change the file extension from .so

to .jnilib

, the JVM can find the files, but it cannot read them (because they were not compiled correctly).

Is there any way, in both Linux and Mac OS X, without source code , to convert these files .so

to .jnilib

? I suspect this is not possible, but Stack Overflow hasn't let me down yet - and I won't count "it's impossible" as a failure.

+2


source to share


1 answer


Are you trying to use the native Linux library on Mac OS X? Not. It won't work.

You need to get the Mac version of your own library and rename it to jnilib if it doesn't already have that suffix.



This is the main difference between JVM bytecode and native code. The native code is very platform specific. We even have multiple versions of JNI libraries for different linux styles.

Since Mac and Linux use the same processor, and they are all Unix based, I would not say that this is not possible, although it is pretty close.

+3


source







All Articles