双击启动 jar 在 32 位 JVM 中启动,但在 64 位 JVM 中从控制台启动 [英] Starting a jar with double click starts in 32bit JVM, but from console in 64bit JVM
问题描述
由于我使用的是本机库,因此我有适用于 32 位和 64 位平台的不同 JAR.现在,当系统上安装了两个 JVM,一个 32 位和一个 64 位时,我会遇到这种行为:
Since I'm using native libraries I have different JARs for 32bit and 64bit platforms. Now when there are two JVMs installed on the system, one 32bit and one 64bit I face this behaviour:
双击 32 位 JAR -> 工作
双击 64 位 JAR -> 应用程序无法启动
Double clicking the 64bit JAR -> App doesn't start
从控制台启动 32 位 JAR -> 错误:此 Java 实例不支持 32 位 JVM.请安装所需的版本.
Starting the 32bit JAR from console -> Error: This Java instance does not support a 32-bit JVM.Please install the desired version.
从控制台启动 64 位 JAR -> 工作
在 Mac 上,当向命令添加 -d32 时,我可以从控制台启动 32 位 JAR.但在 Windows 上,这不起作用.
On Mac I can start the 32bit JAR from console, when adding -d32 to the command. But on Windows, this doesn't work.
我希望,在安装了 64 位 JVM 的系统上,JAR 应该在 64 位 JVM 中启动,无论是通过双击还是通过控制台启动.
I expect, that on a system, where a 64bit JVM is installed, the JAR should start in 64bit JVM, no matter if started by double click or via console.
我有办法做到这一点吗?
I there a way to accomplish that?
推荐答案
检查 PATH
环境变量指向的位置.我想您会发现它指向您的 64 位 JVM,而不是与 .jar
文件关联的默认应用程序,后者可能是您系统上的 32 位 JVM.对齐这两个值,你应该没问题.
Check where the PATH
environment variable points to. I think you will find that it points to your 64-bit JVM, as opposed to the default application associated with .jar
files, which will probably be a 32-bit JVM on your system. Align those two values, and you should be fine.
这篇关于双击启动 jar 在 32 位 JVM 中启动,但在 64 位 JVM 中从控制台启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!