Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

64-bit

jpcap

I am developing a java application using 64 bit eclipse on a 64 bit Windows 7 install. 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.

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. 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. So a Jpcap call is a succession of nested invocations to these libraries.

Here's the question:

Will the application executable work on 64 bit platforms? 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.

like image 602
schinoy Avatar asked Oct 26 '12 02:10

schinoy


People also ask

Can a 32-bit application run with 64-bit Java?

There 32-bit OS and 64-bit OS. If you are running on 32-bit operating system (which is rare to find these days), you can run only 32-bit JVM. On the other hand, if you are running on 64-bit operating system, you can run your application either on 32-bit JVM or on a 64-bit JVM.

Can Java run on 32-bit?

Java is available on Microsoft Windows in 64 and 32 bit versions, allowing users to get the appropriate version for their system.

Is JRE 32 or 64-bit?

The IDL and ENVI Help System, along with the IDL Workbench, require 32-bit JRE's to operate properly. Windows 64-bit systems are able to utilize 32-bit and 64-bit JRE's keeping them in separate locations for system clarity. Installing the 32-bit JRE on a 64-bit Windows system is straight forward.

What is the difference between 32-bit Java and 64-bit Java?

In 32-bit JVM we can have less memory for heap size than in 64-bit JVM. In 64-bit JVM we can specify more memory for heap size than in 32-bit JVM. The limit for maximum memory in 32-bit is useful for 4G connectivity.


2 Answers

Will the application executable work on 64 bit platforms? 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.

You will need to use a 32-bit JRE to run the application. A 64-bit Hotspot JRE cannot use 32-bit native libraries.

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.

And to be clear, you can run a 32-bit JRE on a 64-bit OS platform, but not the other way around.


UPDATE - apparently the jpcap.dll can be built for 64-bit Windows - see this posting: https://groups.google.com/forum/?fromgroups=#!topic/jpcap/-vxZv0eAcp4

like image 82
Stephen C Avatar answered Oct 19 '22 22:10

Stephen C


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.

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)

like image 38
MadProgrammer Avatar answered Oct 20 '22 00:10

MadProgrammer