简体   繁体   English

使用32位java编译器生成的.class文件是否可以在64位JVM的64位系统上使用?

[英]Can a .class file generated using a 32 bit java compiler be used on a 64 bit system with 64 bit JVM?

使用32位java编译器生成的.class文件是否可以在64位JVM的64位系统上使用?

Yes. 是。 Java byte code is independent from 32/64/... bit systems. Java字节代码独立于32/64 / ...位系统。

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). 在该级别上,32位和64位之间没有区别,就像没有32位和64位Java代码(.java)一样。

Yes, the 64 bit VM's main difference is access to a larger maximum amount of memory. 是的,64位VM的主要区别是访问更大的最大内存量。

The whole point of Java is that the compiled .class files work on any Java system, no matter the underlying hardware. Java的重点在于编译的.class文件可以在任何Java系统上运行,无论底层硬件如何。

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. 你的程序将与相比的64位虚拟机运行时,在两个工作在32位和64位系统,但是,如果必要的话,提供的硬件和操作系统是能够胜任工作,你的应用程序将能够访问更多的内存32位VM。

是的,两个版本的Java编译器之间的编译字节码是相同的

byte code, as the name suggests use byte based instructions, if anything byte code is more 8-bit centric. 字节代码,顾名思义使用基于字节的指令,如果任何字节代码更加以8位为中心。 You should expect the 32-bit compiler and 64-bit compiler to produce the same code. 您应该期望32位编译器和64位编译器生成相同的代码。

The only difference between the compilers is what is the native bit size for JVM which runs the compiler when it compiles. 编译器之间的唯一区别是JVM的本机位大小是什么,它在编译时运行编译器。 You shouldn't expect either to perform very differentl except the 64-bit version will not run on a 32-bit OS. 您不应期望执行非常不同的操作,除非64位版本不能在32位操作系统上运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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