在 32 位操作系统上编译的 Java 在 64 位操作系统上出现运行时问题

发布于 2024-11-26 06:28:07 字数 54 浏览 4 评论 0原文

运行在 32 位计算机中编译并在 64 位计算机上运行的 Java 应用程序是否存在已知问题?

Are there known issues with running a Java application compiled in a 32-bit machine and run on a 64-bit machine?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

葵雨 2024-12-03 06:28:07

32 位 JDK 生成的字节码与 64 位 JDK 生成的字节码相同。如果您遇到的问题仅出现在 64 位 JVM 上,那是因为 JVM 中存在错误,使用 64 位 JDK 不会有任何区别。

The byte code generated by a 32-bit JDK is identical to the byte code generated by a 64-bit JDK. If you have a problem which only occurs on a 64-bit JVM, is because there is a bug in the JVM and using a 64-bit JDK wouldn't make any difference.

葬シ愛 2024-12-03 06:28:07

Java 背后的思想是程序的字节码版本对于所有平台都是相同的。这就是为什么您可以在 Windows 计算机上进行编译并在 Linux 机器上运行生成的类和 jar 文件。我每天都会进行这样的交叉编译。

这包括 JVM 使用 32 位还是 64 位。

所以,简单的答案是不,没有问题

(更高级的答案是,如果您还使用随 Java 代码引入的非 Java 本机代码,例如 DLL 等,那么该代码很可能需要重新编译)

The idea behind Java is that the byte code version of a program is the same for all platforms. This is why you can compile on a Windows machine and run the resulting class and jar files on a Linux box. I do such cross compilation daily.

This includes whether the JVM uses 32 or 64 bits.

So, the simple answer is no, there is no issues

(the more advanced answer is that if you also use non-Java native code that you bring in with your Java code, like a DLL or so, then that code will most likely need to be recompiled)

夏日浅笑〃 2024-12-03 06:28:07

这取决于您的应用程序,但在正常情况下,在 x64 机器上运行 x86 机器上的代码不会有问题,反之亦然。

如果您使用普通的旧 java(没有互操作,没有调用本机库),则生成的字节码将与机器无关,并且应该在任何已安装的 JVM 上运行。

It depends on your application, but under normal circumstances, there whould be no problem running code from an x86 machine on an x64 machine, and vice versa.

If you use plain old java (no interop, no call to native libraries), the generated bytecode will be machine-independant, and should run on any installed JVM.

只有一腔孤勇 2024-12-03 06:28:07

除非您显式调用特定于环境的 32 位本机代码,否则我想不到。

Windows 等操作系统使用 WoW64 允许 32 位应用程序在 64 位系统下运行。这是一项允许向后兼容的规定。只要本机库仅依赖于 32 位或仅依赖于 64 位库,一切都很好。 JVM 负责使用 JIT 将字节码转换为适当的机器代码,因此不必担心。

None that I can think of unless you explicitly called 32 bit native code specific to an environment.

Operating systems like windows use WoW64 to allow 32 bit apps to run under 64 bit systems. It is a provision that allows for backward compatibility. As long as native libraries depend only on 32 bit or only on 64 bit libraries, everything is good. The JVM takes care of converting your byte code to the appropriate machine code using JIT so there should be no worries.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文