启动Java时-d32和-d64的用法 [英] Usage of -d32 and -d64 while launching Java

查看:597
本文介绍了启动Java时-d32和-d64的用法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了以下摘录,摘录自 JDK常见问题解答

I read below excerpt from JDK FAQ's


如何在32位和64位操作之间进行选择?默认是什么?
Java启动程序中已将选项-d32和-d64添加到
中,以指定该程序是在32位还是64位
环境中运行。在Solaris上,它们分别对应于ILP32和LP64数据
模型。由于Solaris在同一Java安装中同时包含32位和64位J2SE
实现,因此您可以
指定这两个版本。如果既未指定-d32也未指定-d64,则
的默认值是在32位环境中运行。

How do I select between 32 and 64-bit operation? What's the default? The options -d32 and -d64 have been added to the Java launcher to specify whether the program is to be run in a 32 or 64-bit environment. On Solaris these correspond to the ILP32 and LP64 data models, respectively. Since Solaris has both a 32 and 64-bit J2SE implementation contained within the same installation of Java, you can specify either version. If neither -d32 nor -d64 is specified, the default is to run in a 32-bit environment.

现在为了测试这一点,我登录了我的64位Ubuntu来宾操作系统并安装了64位JDK版本- Linux x64 165.24 MB jdk-8u45-linux-x64.tar.gz

Now to test this, I logged in into my 64 bit Ubuntu guest OS and installed 64 bit JDK version - Linux x64 165.24 MB jdk-8u45-linux-x64.tar.gz.

安装JDK后,当我使用 -d64 运行我的Java程序时,一切都按预期进行,因为实际上是64位安装,但是当我使用 -d32 时,出现错误消息 Error-此Java实例不支持32位JVM

After installing the JDK, when I run my java program using -d64 then everything is as expected because it is in fact a 64 bit installation but when I use -d32 then I get error saying Error - This Java instance does not support 32 bit JVM.

错误对我来说是可以理解的,但令我感到困惑的是这一行(如上引述的段落)选项-d32和- d64已添加到Java启动器中,以指定程序是要在32位还是64位环境中运行。

按照此行,我的理解是,当启动64位版本的Java时,可以使用 -d32 在32位版本中启动它位模式。

Error is understandable to me, but what confuses me is this line (as in above quoted para) "The options -d32 and -d64 have been added to the Java launcher to specify whether the program is to be run in a 32 or 64-bit environment."
As per this line, my understanding is that when launching Java of 64 bit version, -d32 can be used to launch it in 32 bit mode.

问题:


  1. 是我的理解正确吗?

  2. 如果我的理解不正确,那为什么我需要这些命令行参数,因为何时使用<$启动Java? c $ c> java ,则将启动我的PATH中的任何安装(32位或64位JDK)。

  1. Is my understanding correct? And if it is correct, then I am getting error?
  2. If my understanding is not true, then why do I need these command-line arguments, because when I will launch Java using java then whichever installation (32 bit or 64 bit JDK) is in my PATH will be launched.


推荐答案

您所做的引用:


选项-d32和-d64已被使用添加到Java启动器中以指定该程序是在32位还是64位环境中运行。

The options -d32 and -d64 have been added to the Java launcher to specify whether the program is to be run in a 32 or 64-bit environment.

仅对Solaris操作系统。

is valid only for the Solaris operating system.

稍后在 JDK的常见问题解答,我们可以阅读:

Later in the JDK's FAQ, we can read:


所有其他平台(Windows和Linux)分别包含32和64位安装程序包。如果两个软件包都安装在系统上,则可以通过在路径中添加适当的 bin目录来选择一个或另一个。为了保持一致性,Linux上的Java实现接受-d64选项。

All other platforms (Windows and Linux) contain separate 32 and 64-bit installation packages. If both packages are installed on a system, you select one or the other by adding the appropriate "bin" directory to your path. For consistency, the Java implementations on Linux accept the -d64 option.

因此,要回答第二个问题,在Windows和Linux中,这些标志是无用的,并且通过运行相应的JVM安装来完成32/64位选择。

So to answer your second question, in Windows and in Linux, theses flags are useless and the 32/64 bit selection is done by running the corresponding JVM installation.

这篇关于启动Java时-d32和-d64的用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆