简体   繁体   English

JDK 64位还是32位?

[英]JDK 64bit or 32bit?

My pc is using Windows 7 64 bit. 我的电脑使用的是Windows 7 64位。 But the server where my jsp web applications will be deployed is 32 bit. 但是我的jsp Web应用程序部署的服务器是32位。

Do I need to install 32bit JDK/JRE in my PC to develop? 我是否需要在我的PC上安装32位JDK / JRE才能开发? I'm using Eclipse. 我正在使用Eclipse。

Thank you very much. 非常感谢你。

You definitely don't need to install a 32-bit JRE in order to develop. 你绝对不需要安装32位JRE来开发。 The Java code that you build won't have any trace of your 64-bit-ness. 您构建的Java代码将没有任何64位的跟踪。 (I'm assuming you're not using JNI, which would complicate matters somewhat.) (我假设你没有使用JNI,这会使问题复杂化。)

You may want to install a 32-bit JRE for testing purposes though - to make sure you're not trying to use more than 2GB of memory etc. 可能希望安装32位JRE用于测试目的 - 确保您不要尝试使用超过2GB的内存等。

It does not matter. 不要紧。 Java is "compile once, run everywhere", so you don't have to develop on a 64-bits platform just because you deploy to a 64-bits platform, or the other way round. Java是“一次编译,随处运行”,因此您不必仅仅因为部署到64位平台而在64位平台上进行开发,反之亦然。

If the stuff works on your PC, it will work the same on your application server, except in one of these situations: 如果这些东西在您的PC上运行,它将在您的应用程序服务器上运行相同,除了以下情况之一:

  1. You're using JNI (calling "native" code from Java) 您正在使用JNI(从Java调用“本机”代码)
  2. Either of the VMs has a bug the other doesn't have 任何一个虚拟机都有一个其他没有的错误
  3. You code somehow needs to address more memory than a 32-bits process can address. 您的代码需要以某种方式来处理比32位进程可以解决的内存更多的内存。

the bytecode that will result from compilation by your pc with JDK 64bit will be the same as if you had 32bit, the JVM in the application server will run on 32bit - that means, less memory allocation available. 你的电脑用JDK 64bit编译产生的字节码将与32bit一样,应用服务器中的JVM将运行在32bit上 - 这意味着可用的内存分配更少。 If you want to be sure to have the same behavior on memory allocation, you better use the 32bit of the JDK. 如果你想确保在内存分配上有相同的行为,最好使用JDK的32位。 In terms of development, both solutions will work. 在开发方面,两种解决方案都可行。

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

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