简体   繁体   English

本机库,错误:此Java实例不支持32位JVM

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

Hello stackoverflow community, Hello stackoverflow社区,

I'm using NetBeans IDE 7.2.1, and I'm trying to compile+run a project with native libraries. 我正在使用NetBeans IDE 7.2.1,我正在尝试使用本机库编译+运行项目。 My libraries require a 32 bit JVM. 我的库需要32位JVM。 I'm running Windows 7 64-bit. 我正在运行Windows 7 64位。 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
    -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. 我安装了64位JRE和32位JRE,并且我的平台管理器中都提供了64位JDK和32位JDK。

Any suggestions to resolve this? 有什么建议可以解决吗? I've read that you can get issues by installing the 64 bit JRE before the 32 bit JRE; 我已经读过你可以通过在32位JRE之前安装64位JRE来解决问题; is this one of those issues? 这是其中一个问题吗? (I have indeed installed 64 bit first) (我确实先安装了64位)

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. 当您启动进程时(例如在命令提示符下,但是当您从代码启动另一个进程时它是相同的AFAIK)将搜索某组路径(包含在PATH(?)环境变量中)以查找具有名称的可执行文件匹配您输入的内容。 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. 如果64位和32位版本具有相同的名称并且首先找到64位版本,则将执行该版本。 I recommend specifying the full path of the 32-bit JDK. 我建议指定32位JDK的完整路径。

EDIT: 编辑:
I just saw the question is about the NetBeans IDE. 我刚看到这个问题是关于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. 我从来没有使用过,所以我能给你的唯一建议是查看NetBeans的设置,并调整JDK和JRE的路径,使其指向32位版本。 I'll leave my answer here for people not using NetBeans. 对于不使用NetBeans的人,我会在这里留下我的答案。

Thanks to @11684 for the great answer. 感谢@ 11684的最佳答案。 I would simply like to add a code example for those who compile from the command line/Command Prompt. 我只想为那些从命令行/命令提示符编译的人添加一个代码示例。

For the compilation, it shouldn't matter which javac gets used - 32-bit or 64-bit. 对于编译,使用哪个javac无关紧要 - 32位或64位。

>javac MyJavaProgramUsing32BitNativeLib.java

For the actual execution of the program, it is important to specify the path to the 32-bit version of java.exe 对于程序的实际执行,指定32位版本的java.exe的路径重要

I'll post a code example for Windows , since that seems to be the OS used by the OP. 我将发布Windows的代码示例,因为这似乎是OP使用的操作系统。

Windows 视窗

Most likely, the code will be something like: 最有可能的是,代码将类似于:

>"C:\Program Files (x86)\Java\jre#.#.#_###\bin\java.exe" MyJavaProgramUsing32BitNativeLib 

The difference will be in the numbers after jre . 差异将在jre之后的数字中。 To find which numbers you should use, enter: 要查找应使用的数字,请输入:

>dir "C:\Program Files (x86)\Java\"

On my machine, the process is as follows 在我的机器上,过程如下

C:\Users\me\MyProject>dir "C:\Program Files (x86)\Java"
 Volume in drive C is Windows
 Volume Serial Number is 0000-9999

 Directory of C:\Program Files (x86)\Java

11/03/2016  09:07 PM    <DIR>          .
11/03/2016  09:07 PM    <DIR>          ..
11/03/2016  09:07 PM    <DIR>          jre1.8.0_111
               0 File(s)              0 bytes
               3 Dir(s)  107,641,901,056 bytes free

C:\Users\me\MyProject>

So I know that my numbers are 1.8.0_111 , and my command is 所以我知道我的数字是1.8.0_111 ,我的命令是

C:\Users\me\MyProject>"C:\Program Files (x86)\Java\jre1.8.0_111\bin\java.exe" MyJavaProgramUsing32BitNativeLib

暂无
暂无

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

相关问题 Eclipse-此Java实例不支持32位JVM - Eclipse - This Java instance does not support a 32-bit JVM 试图在IntelliJ中运行Android项目:错误:异常的构建过程终止:错误:此Java实例不支持32位JVM。 - Trying to run an Android project in IntelliJ: Error:Abnormal build process termination: Error: This Java instance does not support a 32-bit JVM. Android Studio Emulator - Java实例不支持32位JVM - Android Studio Emulator - Java instance does not support 32 bit JVM Apex数据加载器 - 错误java.lang.UnsatisfiedLinkError:无法在64位JVM上加载32位SW T库 - Apex Data loader - Error java.lang.UnsatisfiedLinkError: Cannot load 32-bit SW T libraries on 64-bit JVM java.lang.UnsatisfiedLinkError:无法在Windows中的64位JVM上加载32位SWT库 - java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM in windows 是否由在32位JVM中运行的Java程序访问64位库导致此错误? - Is this error caused by a 64-bit library being accessed by a Java program running in a 32-bit JVM? java.lang.UnsatisfiedLinkError:无法在Windows x86机器上的32位JVM上加载64位SWT库 - java.lang.UnsatisfiedLinkError: Cannot load 64-bit SWT libraries on 32-bit JVM in Windows x86 machine maven-surefire-plugin失败,错误为“无法在64位JVM上加载32位SWT库” - maven-surefire-plugin fails with error “Cannot load 32-bit SWT libraries on 64-bit JVM” JavaFX 是否在 32 位 Windows 中工作? (或使用 32 位 JVM)? - Does JavaFX work in 32-bit Windows? (or with a 32-bit JVM)? 无法在32位JVM上加载64位SWT库(即使我下载了32位SWT) - Cannot load 64-bit SWT libraries on 32-bit JVM (even though I downloaded 32-bit SWT)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM