This discussion is archived
6 Replies Latest reply: Aug 25, 2011 4:41 PM by jschellSomeoneStoleMyAlias RSS

Select 32 bit VM on 64 bit System

883772 Newbie
Currently Being Moderated
Hello,

I'm developping an application which needs a 32-Bit VM because the use of a native 3rd party library which only supports 32-Bit. On a 64-Bit system which installed 32 and 64-Bit JRE I tried using the -d32 switch to force the use of the 32-Bit JRE. But I get the following error message:

C:\Users\tom>java -d32 -version
Error: This Java instance does not support a 32-bit JVM.
Please install the desired version.

But the following works:

C:\Users\tom>java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

and this also:

C:\Users\tom>"C:\Program Files (x86)\Java\jre7\bin\java.exe" -d32 -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode, sharing)

I tried reinstalling the JREs but it doesn't help. So, why does'n the launcher find the 32-Bit JRE? Why doesn't the switch work as described ([http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#64bit_selection])?
  • 1. Re: Select 32 bit VM on 64 bit System
    EJP Guru
    Currently Being Moderated
    Moderator action: Deleted two duplicates of this.
  • 2. Re: Select 32 bit VM on 64 bit System
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated
    So, why does'n the launcher find the 32-Bit JRE?
    As guess...
    - Launcher finds a VM.
    - Runs VM
    - passes command line arguments.

    First step has nothing to do with the last.

    Presumably you have tested your app including the library to verify that with the correct VM and 3rd party library it works.
    If so then the 3rd party library has nothing to do with it.


    What you want to do is run a specific VM. There are threads that discuss that.
  • 3. Re: Select 32 bit VM on 64 bit System
    883772 Newbie
    Currently Being Moderated
    And what does the -d32 parameter do? Except not working and displaying an error message?
    Unfortunately I didn't find any useful threads for my problem in this forum (maybe I used the wrong keywords?).

    The only solution I currently have is to write a lancher application which searches in the Windows Registry for installed 32-Bit-JREs, looks which is the newest one and passes all parameters to the javaw.exe of the desired JRE. But I thought there could be an easier way, maybe that C:\Windows\system32\javaw.exe does exactly this:
    -d32 parameter present: start the newest 32-Bit VM
    -d64 parameter present: start the newest 64-Bit VM
  • 4. Re: Select 32 bit VM on 64 bit System
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated
    880769 wrote:
    And what does the -d32 parameter do? Except not working and displaying an error message?
    Docs tell you what it does.

    http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#64bit_layering
    The only solution I currently have is to write a lancher application which searches in the Windows Registry for installed 32-Bit-JREs, looks which is the newest one and passes all parameters to the javaw.exe of the desired JRE.
    That isn't the only option.

    Option 1: Obviously "java" does something. So if the target OS has been setup to use "java" then you use what it is set up as.
    Option 2: Create an installer that requires the user to tell you what to use and where it is.
    Option 3: Create an installer that finds the newest version and then creates a 'launcher' (which could be a batch file) with that version.
    Option 4: Create an installer that installs the version of java that comes with your installer and it also provides a launcher that uses it. Just lay down the binaries. One advantage to this solution is that you don't need to concern your self that every new java minor release will break your product (which apparently has happened in some cases with some Oracle minor releases.)

    There are probably others.
  • 5. Re: Select 32 bit VM on 64 bit System
    802316 Pro
    Currently Being Moderated
    To my knowledge, the -d32 and -d64 options only works correctly on Solaris as there is one install for both JVMs. You might be able install the 32-bit and 64-bit versions into the same directory. However on Linux and Windows I believe you need to specific the base directory to of java to use a particular version. In Linux this is less of a problem with the use of symbolic links. In Windows you can copy the Java.exe to Java32.exe to make that version selectable.
  • 6. Re: Select 32 bit VM on 64 bit System
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated
    Peter Lawrey wrote:
    To my knowledge, the -d32 and -d64 options only works correctly on Solaris as there is one install for both JVMs.
    That is what the link says.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points