Can a .class file generated using a 32 bit java compiler be used on a 64 bit system with 64 bit JVM?
Can a .class file generated using a 32 bit java compiler be used on a 64 bit system with 64 bit开发者_如何学JAVA JVM?
Yes. Java byte code is independent from 32/64/... bit systems.
That's the main purpose: the compiled code shall be executable on any system, just the virtual machine is compiled for a special system architecture.
Yes, bytecode is still very high level. There is no distinction between 32 and 64 bit at that level, just as there is no 32 and 64 bit Java code (.java).
Yes, the 64 bit VM's main difference is access to a larger maximum amount of memory.
The whole point of Java is that the compiled .class files work on any Java system, no matter the underlying hardware.
Your program will work on both a 32 bit and 64 bit system, but, if necessary, provided the hardware and OS is up to the job, your app will be able to access much more memory when running in a 64 bit VM compared with a 32 bit VM.
Yes, The compiled bytecode is the same between both versions of Java compilers
byte code, as the name suggests use byte based instructions, if anything byte code is more 8-bit centric. You should expect the 32-bit compiler and 64-bit compiler to produce the same code.
The only difference between the compilers is what is the native bit size for JVM which runs the compiler when it compiles. You shouldn't expect either to perform very differentl except the 64-bit version will not run on a 32-bit OS.
精彩评论