JNI in 64bit machine

J

j2eepgrmr

I have a dynamic library compiled on a 32 bit Linux machine. Is it
possible to run it on a 64-bit machine?

The following link says ...

http://java.sun.com/j2se/1.4.2/docs/guide/vm/

Users of the Java Native Interface will need to recompile their code to
be able to run it on the 64-bit VM.


Currently I don't have access to 64-bit machine, so I am trying to see
if anyone has run across this issue.

Thanks
 
N

Nigel Wade

j2eepgrmr said:
I have a dynamic library compiled on a 32 bit Linux machine. Is it
possible to run it on a 64-bit machine?

The following link says ...

http://java.sun.com/j2se/1.4.2/docs/guide/vm/

Users of the Java Native Interface will need to recompile their code to
be able to run it on the 64-bit VM.


Currently I don't have access to 64-bit machine, so I am trying to see
if anyone has run across this issue.

Thanks

The simplest solution would be to use a 32bit JVM on the 64bit machine. How well
this works will depend on the processor.

Can you build a 64bit version of the library on a 32bit platform, using compiler
options to specify the architecture? You can certainly build 32bit
objects/libraries using gcc on Linux/AMD64 using the -m32 flag and there is a
corresponding -m64 flag to indicate 64bit objects which might do the trick.
 
R

Roedy Green

Users of the Java Native Interface will need to recompile their code to
be able to run it on the 64-bit VM.

With JAWS you put the 64-bit compiled JNI code in a different jar,
and explain in the JNLP which jar goes with which platform and from
there, getting the right one is automatic.
 
J

j2eepgrmr

Thanks Nigel. I saw the compiler option in g++ and tried it out on a 32
bit Linux box and here is what I got.

g++ -m64 test2.cpp
cc1plus: sorry, unimplemented: 64-bit mode not compiled in

So I need a 64 bit machine to compile :(
 
J

j2eepgrmr

Roedy ...

I'll check out JAWS. The native code I have is really simple and I
didn't try to use any third party s/w earlier.

Thanks
 
R

Roedy Green

I'll check out JAWS. The native code I have is really simple and I
didn't try to use any third party s/w earlier

My first JNI project was in an Applet, SetClock. The nightmare was
getting the DLL in place on the path somewhere and recognized. This
becomes platform/browser dependent code. I eventually put it on the
shelf as too unreliable. The I resurrected it as a JAWS app with no
trouble.

With JAWS, getting your DLL on the path before you app starts to
execute, is automatic.

see http://mindprod.com/jgloss/javawebstart.html
 

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

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top