简体   繁体   中英

Safe to build with java 32bit if other jars where compiled with 64bit?

I had a 64-bit system to build a java project. For now I'm stuck with a 32-bit machine. Will the bytecode be any different using javac x32 versus javac x64. ie I need to send a bug fix and I'm not sure I can send a jar file compiled with javac x32 if all the rest of the jars where compiled with x64.

Found this but, I'm still not quite sure.

java-32-bit-vs-64-bit-compatibility

正如您所链接的答案中所提到的那样,它应该工作得非常好Java字节码是完全独立于平台的

Like the link and everyone else said: It will be fine.

What may be confusing you is the difference between the JIT compiler and the javac compiler . The JIT compiler is part of the virtual machine - unlike javac - and has different default settings on 32- and 64-bit Windows machines. This will effect performance like execution speed and memory usage when bytecode - compiled by javac - is run, but it doesn't effect compatibility of code compiled by javac . The output of javac with will on any compliant JVM.


Looking at your comments, I think this info might help you, too: Java code invokes .dll/.so s simply with a call to a method with the native modifier, as in public native byte[] doFoo(byte[] img); . Typically, these methods have behavior that is specified to be the same across all systems, and some behavior that is unspecified (see FileChannel). Unless the project you delivered a fix for is really weird, Java almost always is system-agnostic, meaning Java code only deals with system-independent behavior. You should rarely see Java source code that does different things on different system. If you only wrote Java code, your fix should work across all systems that the project is deployed to. But there's no guarantee. Look at the documentation for any classes and methods you used to make sure they fully abstract the operating system from the Java source code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM