Using -d32 and -d64 when starting Java

Below I read an excerpt from JDK Questions

How to choose between 32 and 64-bit operation? What is the default? The -d32 and -d64 options have been added to the Java launcher to indicate whether the program should run in a 32 or 64-bit environment. In Solaris, they correspond to the ILP32 and LP64 models, respectively. Since Solaris has 32 and 64-bit J2SE implementations contained within the same Java installation, you can specify any version. If -d32 or -d64 is not specified, it starts by default in a 32-bit environment.

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

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

The error is clear to me, but this line bothers me (as in the paragraph above) "The -d32 and -d64 parameters were added to the Java start-up to indicate whether the program should run in a 32 or 64-bit environment."
According to this line, I understand that when starting Java with a 64-bit version, -d32 can be used to run in 32-bit mode.

Questions:

  • Do I understand correctly? And if this is correct, then do I get an error?
  • If my understanding is incorrect, then why do I need these command line arguments, because when I started Java using java , then whatever installation (32-bit or 64-bit JDK) in my PATH would not start.
+8
source share
1 answer

Quote you made:

The -d32 and -d64 options were added to the Java startup to indicate whether the program should run in a 32-bit or 64-bit environment.

valid for Solaris operating system only.

Later in the JDK FAQ , we can read:

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

So, to answer your second question, on Windows and Linux these tags are useless, and the selection of 32/64 bits is done by running the appropriate JVM installation.

+12
source

Source: https://habr.com/ru/post/989827/


All Articles