JNI loadlibrary choosing dll or so

M

Marcelo

Dear programmers,

I am having some trouble in order to determine the OS used by the JVM. I would
like to load some libraries but i don't know the system that is running it.

I would like to do something like:

static{
if(Linux)
System.loadLibrary("libHello.so");
if(Windows)
System.loadLibrary("Hello.dll");
}

Can you help me, please?

thanks a lot,

Marcelo
 
G

Gordon Beaton

I would like to do something like:

static{
if(Linux)
System.loadLibrary("libHello.so");
if(Windows)
System.loadLibrary("Hello.dll");
}

This will fail in both cases. Juse specify the base name of the
library, i.e.:

System.loadLibrary("Hello");

The JVM will load "libHello.so" or "Hello.dll", whichever is
appropriate for the platform.

/gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top