Can a .class file created using a 32-bit java compiler be used on a 64-bit system with a 64-bit JVM?

Can a .class file created using a 32-bit java compiler be used on a 64-bit system with a 64-bit JVM?

+4
source share
5 answers

Yes. Java bytecode is independent of 32/64 / ... bit systems.

This is the main goal: the compiled code must be executable on any system, only the virtual machine is compiled for a special system architecture.

+6
source

Yes, the bytecode is still very high. There is no difference between 32 and 64 bits at this level, just as there is no 32 and 64 bit Java code (.java).

+6
source

Yes, the main difference in a 64-bit virtual machine is access to a larger maximum amount of memory.

The whole point of Java is that compiled .class files work on any Java system, no matter what the hardware is based on.

Your program will work on both a 32-bit and a 64-bit system, but if necessary, if the equipment and the OS work, your application will be able to get much more memory when working in a 64-bit virtual machine compared to a 32-bit virtual machine.

+4
source

Yes, the compiled bytecode is the same between both versions of Java compilers

+2
source

since the name implies the use of byte instructions if any byte code is more than 8-bit. You should expect the 32-bit compiler and the 64-bit compiler to generate the same code.

The only difference between compilers is that there is a native bit size for the JVM that the compiler starts when compiling. You should not expect it to work very hard, except that the 64-bit version will not work on a 32-bit OS.

0
source

Source: https://habr.com/ru/post/1336761/


All Articles