Matthew Sutter Matthew Sutter - 1 year ago 181
Java Question

Native Libraries, Error: This Java instance does not support a 32-bit JVM

Hello stackoverflow community,

I'm using NetBeans IDE 7.2.1, and I'm trying to compile+run a project with native libraries. My libraries require a 32 bit JVM. I'm running Windows 7 64-bit. When attempting to compile+run my project I'm met with the following:

Error: This Java instance does not support a 32-bit JVM.
Please install the desired version.
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

I have tried going to configuration and included the following arguments (to no avail):

-d32 -vm "C:\Program Files (x86)\Java\jre7\bin\javaw.exe"
-vm "C:\Program Files (x86)\Java\jre7\bin\javaw.exe"

I have both 64 bit JRE and 32 bit JRE installed, and both a 64 bit JDK and 32 bit JDK available in my platform manager.

Any suggestions to resolve this? I've read that you can get issues by installing the 64 bit JRE before the 32 bit JRE; is this one of those issues? (I have indeed installed 64 bit first)

Answer Source

When you start a process (for example on the command prompt, but it's the same AFAIK when you start another process from code) a certain group of paths (contained in the PATH (?) environment variable) is searched for an executable with a name matching what you entered. If the 64-bit and 32-bit version have the same name and the 64-bit version is found first, that one will be executed. I recommend specifying the full path of the 32-bit JDK.

I just saw the question is about the NetBeans IDE. I've never used that, so the only advice I can give you is to look in NetBeans' settings, and adjust the path to the JDK and JRE, making it point to the 32-bit version. I'll leave my answer here for people not using NetBeans.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download