简体   繁体   English

使用Eclipse在64位计算机上编译32位Java构建

[英]Compile 32 bit Java builds on 64 bit machine with Eclipse

so the questions as in the title, I need to run my server application in Tomcat on a System which is 32 bit Windows XP, I am working and compiling on my 64 bit Windows 7 in Eclipse. 所以标题中的问题,我需要在32位Windows XP的系统上运行Tomcat中的服务器应用程序,我正在使用Eclipse中的64位Windows 7进行编译。 How do I compile it to 32 bit, what do I need to do? 如何将其编译为32位,我需要做什么? I assume it won't work on the 32 bit Windows when I'm compiling it on a 64 bit machine? 我假设当我在64位机器上编译时,它无法在32位Windows上运行?

Java doesn't build 32-bit or 64-bit applications - bytecode is portable across different bit architectures. Java不构建32位或64位应用程序 - 字节码可以跨不同的位体系结构移植。

The only exception is native libraries that you might be using in your code. 唯一的例外是您可能在代码中使用的本机库。 If there are any then you will have to manually compile those for the respective platform. 如果有,那么您将不得不手动编译相应平台的那些。 Otherwise the java code is totally portable across 32-bit and 64-bit platforms. 否则,java代码在32位和64位平台上完全可移植。

问题是你的JNI DLL,它需要编译为32位以匹配32位JRE。

Java is independent of the OS. Java独立于操作系统。

You can compile with your 64bit machine and run this on a 32bit computer as long as this computer has a 32bit VM. 您可以使用64位计算机进行编译,并在32位计算机上运行此计算机,只要此计算机具有32位VM即可。

If you're still searching for some "simple" solution, one would be to install a 32 bit os in a virtual machine and run eclipse from there.. Very ugly I know, but it works. 如果你还在寻找一些“简单”的解决方案,那就是在虚拟机中安装32位操作系统并从那里运行eclipse。我知道这很难看,但它确实有用。

Another approach is mentioned here. 这里提到了另一种方法。 How to launch java swing app which used precompled DLL from cmd? 如何启动使用cmd中预先复制的DLL的java swing应用程序?

You could install a 32bits jdk on a 64bits machine. 你可以在64位机器上安装32位jdk。 point the JAVA_HOME to this jdk and use it. 将JAVA_HOME指向此jdk并使用它。 It

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

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