Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   How to use 32 bits JRE on Windows 7 64 bits computer? (http://www.velocityreviews.com/forums/t946872-how-to-use-32-bits-jre-on-windows-7-64-bits-computer.html)

zyng 06-07-2012 06:46 PM

How to use 32 bits JRE on Windows 7 64 bits computer?
 
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.

Robert Klemme 06-07-2012 07:49 PM

Re: How to use 32 bits JRE on Windows 7 64 bits computer?
 
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/

zyng 06-08-2012 12:40 AM

Re: How to use 32 bits JRE on Windows 7 64 bits computer?
 
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.

Roedy Green 06-08-2012 01:31 AM

Re: How to use 32 bits JRE on Windows 7 64 bits computer?
 
On Thu, 7 Jun 2012 11:46:11 -0700 (PDT), zyng <xsli2@yahoo.com> 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 06-08-2012 01:31 AM

Re: How to use 32 bits JRE on Windows 7 64 bits computer?
 
On Thu, 7 Jun 2012 11:46:11 -0700 (PDT), zyng <xsli2@yahoo.com> 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
..

Robert Klemme 06-08-2012 11:04 AM

Re: How to use 32 bits JRE on Windows 7 64 bits computer?
 
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


All times are GMT. The time now is 05:43 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.