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

Z

zyng

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.
 
R

Robert Klemme

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
 
Z

zyng

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.
 
R

Roedy Green

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
..
 
R

Roedy Green

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
..
 
R

Robert Klemme

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top