简体   繁体   English

我可以运行使用32位jdk和64位jre开发的java程序吗?应用程序使用32位非Java系统库

[英]Can I run a java program developed using 32 bit jdk with 64 bit jre? application uses 32 bit non java system libraries

I am developing a java application using 64 bit eclipse on a 64 bit Windows 7 install. 我正在64位Windows 7安装上使用64位eclipse开发一个java应用程序。 I'm forced to use a 32 bit JDK(1.7.0) because the application uses Jpcap , which wont compile with a 64 bit JDK. 我被迫使用32位JDK(1.7.0),因为应用程序使用Jpcap ,它不会使用64位JDK编译。

The application has to be cross platform across 32 bit and 64 bit systems, which is normally the case with java applications developed using any JDK. 应用程序必须跨32位和64位系统跨平台,这通常是使用任何JDK开发的Java应用程序的情况。 But I believe the situation is slightly complicated because besides a jar, Jpcap installs system libraries (.dll/.so) which in turn are wrappers for WinPcap and libpcap. 但我相信这种情况有点复杂,因为除了jar之外,Jpcap还会安装系统库(.dll / .so),后者又是WinPcap和libpcap的包装器。 So a Jpcap call is a succession of nested invocations to these libraries. 因此,Jpcap调用是对这些库的一系列嵌套调用。

Here's the question: 这是问题:

Will the application executable work on 64 bit platforms? 应用程序可执行文件是否可在64位平台上运行 assuming users will have the required x86 libraries installed (jpcap.dll/.so, WinPcap, libpcap) as 64 bit versions do not exist for the windows libs. 假设用户将安装所需的x86库(jpcap.dll / .so,WinPcap,libpcap),因为Windows库不存在64位版本。

Will the application executable work on 64 bit platforms? 应用程序可执行文件是否可在64位平台上运行 assuming users will have the required x86 libraries installed (jpcap.dll/.so, WinPcap, libpcap) as 64 bit versions do not exist for the windows libs. 假设用户将安装所需的x86库(jpcap.dll / .so,WinPcap,libpcap),因为Windows库不存在64位版本。

You will need to use a 32-bit JRE to run the application. 您将需要使用32位JRE来运行该应用程序。 A 64-bit Hotspot JRE cannot use 32-bit native libraries. 64位Hotspot JRE无法使用32位本机库。

But the flipside is that it doesn't matter if you use a 64-bit or 32-bit Eclipse for developing and building ... provided that you configure Eclipse to launch a 32-bit JRE for any testing that involves the native libraries. 但另一方面是,如果您使用64位或32位Eclipse进行开发和构建,则无关紧要...前提是您将Eclipse配置为针对涉及本机库的任何测试启动32位JRE。

And to be clear, you can run a 32-bit JRE on a 64-bit OS platform, but not the other way around. 需要说明的是,您可以在64位操作系统平台上运行32位JRE,但不是相反。


UPDATE - apparently the jpcap.dll can be built for 64-bit Windows - see this posting: https://groups.google.com/forum/?fromgroups=#!topic/jpcap/-vxZv0eAcp4 更新 - 显然jpcap.dll 可以为64位Windows构建 - 请参阅此帖子: https ://groups.google.com/forum/?fromgroups =#!topic / jpcap / -vxZv0eAcp4

From memory (and it's a little foggy) I'd so no. 从记忆中(它有点模糊)我不是。

Native libraries (at least under windows) need to be executed within the same bit beepthness as the JVM. 本机库(至少在Windows下)需要在与JVM相同的位内执行。

So, in order for you to be able to load your x32 bit libraries, you should be running within a x32 bit process (or x32 bit JVM) 因此,为了能够加载x32位库,您应该在x32位进程(或x32位JVM)中运行

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

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