How to use 32 bits JRE on Windows 7 64 bits computer?

Discussion in 'Java' started by zyng, Jun 7, 2012.

  1. zyng

    zyng Guest

    Both 32 bits and 64 bits JRE are installed on Windows 7 64 bits computer. Normally, 64 bits JRE is used.

    Right now, for some reason, we hope that 32 bits JRE is used when running a commercial Java program. Is this only the matter of setting the environment variable JAVA_HOME? We have tried that and it didn't show the effect we expected.

    Thank you.
    zyng, Jun 7, 2012
    #1
    1. Advertising

  2. On 07.06.2012 20:46, zyng wrote:
    > Both 32 bits and 64 bits JRE are installed on Windows 7 64 bits
    > computer. Normally, 64 bits JRE is used.
    >
    > Right now, for some reason, we hope that 32 bits JRE is used when


    What do you mean by "we hope"? Do you /want/ the 32 bit JRE to be used?
    Or are you /assuming/ it is used?

    > running a commercial Java program. Is this only the matter of setting
    > the environment variable JAVA_HOME? We have tried that and it didn't
    > show the effect we expected.


    That depends entirely how the "commercial Java program" uses the JVM.
    Could be a script, an executable etc. and we have no way of knowing how
    it determines the JVM to use. Please provide more detail, especially
    what you expected and maybe also what "commercial Java program" we are
    talking about.

    Kind regards

    robert

    --
    remember.guy do |as, often| as.you_can - without end
    http://blog.rubybestpractices.com/
    Robert Klemme, Jun 7, 2012
    #2
    1. Advertising

  3. zyng

    zyng Guest

    Thank you for your reply. The issue has been solved.

    Just another question, on Microsoft Windows computer, I have installed JDK and have set the environment variable JAVA_HOME:

    (in Cygwin)
    $ echo $JAVA_HOME
    C:\Program Files\Java\jdk1.6.0_32

    However, it seems "java" command is not from the JDK I installed, it is from c/Windows/system32/java. Why is that?

    $ java -version
    java version "1.6.0_31"
    Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
    Java HotSpot(TM) Client VM (build 20.6-b01, mixed mode, sharing)

    $ which java
    /cygdrive/c/Windows/system32/java

    So, on my computer, I have two "java" commands. Is this one(c/Windows/system32/java) a gift from Microsoft?

    I am puzzled.

    Thank you very much.
    zyng, Jun 8, 2012
    #3
  4. zyng

    Roedy Green Guest

    On Thu, 7 Jun 2012 11:46:11 -0700 (PDT), zyng <> wrote,
    quoted or indirectly quoted someone who said :


    >Right now, for some reason, we hope that 32 bits JRE is used when running a commercial Java program.
    > Is this only the matter of setting the environment variable JAVA_HOME? We have tried that and it didn't show the effect we expected.


    Astoundingly, the browsers find and load the appropriate JVM
    automagically. Chrome needs a little help, but basically it is
    automatic.

    See http://mindprod.com/jgloss/googlechrome.html

    You can verify this by running http://mindprod.com/applet/wassup.html
    Try out IE 64 bit, and Firefox 32 bit or any of the other browsers at
    http://mindprod.com/jgloss/browser.html

    look for os.arch = amd64 vs x86 for 64 bit vs 32 bit or references to
    Program Files vs Program Files (x86).

    This applies to windows.
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    Controlling complexity is the essence of computer programming.
    ~ Brian W. Kernighan 1942-01-01
    ..
    Roedy Green, Jun 8, 2012
    #4
  5. zyng

    Roedy Green Guest

    On Thu, 7 Jun 2012 11:46:11 -0700 (PDT), zyng <> wrote,
    quoted or indirectly quoted someone who said :

    >Both 32 bits and 64 bits JRE are installed on Windows 7 64 bits computer. Normally, 64 bits JRE is used.
    >
    >Right now, for some reason, we hope that 32 bits JRE is used when running a commercial Java program.
    > Is this only the matter of setting the environment variable JAVA_HOME? We have tried that and it didn't show the effect we expected.


    Astoundingly, your browser selects the appropriate 32 or 64 bit JVM
    automagically. You can verify this by running
    http://mindprod.com/applet/wassup.html

    Which is used for an app depends which is first on the path. You can
    also put it on the pseudo path in the registry for Windows.
    http://mindprod.com/jgloss/registry.html#AUXPATH

    It is easiest to just specify fully if you flip often e.g.

    E:\Program Files\Java\jdk1.7.0_04\bin\java.exe

    or put it into a central global SET variable.
    es.g.

    set JAVA=E:\Program Files\Java\jdk1.7.0_04\bin\java.exe

    %java% -ea someparm
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    Controlling complexity is the essence of computer programming.
    ~ Brian W. Kernighan 1942-01-01
    ..
    Roedy Green, Jun 8, 2012
    #5
  6. On Friday, June 8, 2012 2:40:39 AM UTC+2, zyng wrote:
    > Thank you for your reply. The issue has been solved.
    >
    > Just another question, on Microsoft Windows computer, I have installed JDK and have set the environment variable JAVA_HOME:
    >
    > (in Cygwin)
    > $ echo $JAVA_HOME
    > C:\Program Files\Java\jdk1.6.0_32
    >
    > However, it seems "java" command is not from the JDK I installed, it is from c/Windows/system32/java. Why is that?


    Because the shell does not use JAVA_HOME but PATH for lookup of executables..

    > $ java -version
    > java version "1.6.0_31"
    > Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
    > Java HotSpot(TM) Client VM (build 20.6-b01, mixed mode, sharing)
    >
    > $ which java
    > /cygdrive/c/Windows/system32/java
    >
    > So, on my computer, I have two "java" commands. Is this one(c/Windows/system32/java) a gift from Microsoft?


    Might be. Might also be that one Java installation put their executable there. Bottom line, you better make sure the proper executables from an installation directory are used. I typically have scripts which will honor JAVA_HOME and pick the proper executables so I can easily switch Java versions..

    Kind regards

    robert
    Robert Klemme, Jun 8, 2012
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nospawn
    Replies:
    2
    Views:
    511
    Real Gagnon
    Apr 25, 2006
  2. GGG
    Replies:
    10
    Views:
    12,539
    Donar
    Jul 6, 2006
  3. Prasoon
    Replies:
    1
    Views:
    463
    Andrew Thompson
    Apr 13, 2007
  4. Artur McCennon
    Replies:
    0
    Views:
    396
    Artur McCennon
    Jul 22, 2009
  5. Jochen Brenzlinger
    Replies:
    5
    Views:
    918
    Roedy Green
    Sep 2, 2011
Loading...

Share This Page