Re: 32 bit applet on 64 bit Java?
On 09/11/10 15:29, John Smith wrote:
The crash happens when the JNI library executes memcpy command.
I think the code should be ok because it already works for a long time.
Hmmm, just because it's worked up to now in no way guarantees that the
code is ok. Especially so if the code is ported from a 32bit environment
and compiled for 64bit.
C (assuming it is C) is quite unforgiving of changes in architecture
when certain false assumptions are made (such as using non-pointer types
to store address/pointers and coercing the access). It's "valid" code,
in that the compiler won't necessarily warn you that what you've done is
wrong, and it will compile and run. It just won't work the way you want,
it may work perfectly well for quite some time, overwriting unimportant
code and data - until the day it doesn't work. Maybe that day is today.
It may be because the applet is 32 bit and the JNI is now 64 bit
compiled. The universal or 32 bit compiled JNI does not load due to
"wrong architecture" error.
Java byte-code is not 32bit or 64bit. It's architecture neutral.
However, the JVM plugin which is run by the browser, and any JNI which
is loaded by the JVM, will almost certainly need to match the
architecture of the browser. So if the browser is 64bit then the JVM
plugin will be 64bit and any JNI it loads will also need to be 64bit. As
will any other library that the JNI loads.
1. Should I try to compile the JNI to 32 bit as well and try to make it
work? I get a compile time warning ("file was built for unsupported file
format which is not the architecture being linked i386").
I doubt that that will work. If the browser/JVM is 64bit it will only
execute 64bit code.
2. Or should I compile the java applet to 64 bit?
There is no such animal. You can compile the Java using a 32bit or a
64bit JDK and run the generated byte-code on any compliant JVM, 32bit or
3. Are java applications even different when compiled with 32 and 64 java?
Maybe very, very slightly, but not so you'd notice. They may be identical.
You really need to compile all your JNI, and associated other libraries,
as 64bit and verify that they actually execute as intended in a 64bit