Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to determine 32-bit or 64-bit version of java on Windows?

Posted on 2011-10-05
14
Medium Priority
?
554 Views
Last Modified: 2012-05-12
Hi there,

How do I determine 32-bit or 64-bit version of java on Windows?
Just run   java -version  and see if 64-bit appears?

Thanks.

0
Comment
Question by:asugri
  • 7
  • 3
  • 2
  • +2
14 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 1200 total points
ID: 36922100
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36922105
probably
java -d64 -version is the way
At least on my 32 bit it complains
0
 
LVL 13

Expert Comment

by:Hugh McCurdy
ID: 36922200
Here's what happens if I try for_yan's suggestion on 32bit Linux

$ java -d64
Running a 64-bit JVM is not supported on this platform.

I can test on 64-bit windows if you request it.  (I have to reboot so I'll want a request before I bother).
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 47

Expert Comment

by:for_yan
ID: 36922237
No it looks like -d64 works only on Solaris not on Windows

It lloks like you have to do it from java program using System.getProperty("sun.arch.data.model")

I also thought that default installation directory of java on Windows is named differently, but of vourse one may
install it not in the default directory
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 1200 total points
ID: 36922253
I am also wondering - on 32bit machine when
I go say to -Xmx1800M - it writes not enough memory

C:>java -Xmx1800M -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

Does it depeden on the machine? Probably not as I have more memory.

So maybe 64bit would allow more?
so it is worth trying on 64bit:

java -Xmx2000M -version

0
 
LVL 13

Assisted Solution

by:Hugh McCurdy
Hugh McCurdy earned 280 total points
ID: 36922278
Not just Solaris.  Linux too.  But then it's likely not that different.  I'll reboot and test.
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36922289
Yes, someone writes there, that -d64 does not work on windows
and in the description of java switches for Solaris they mention that -d64 should work.
Perhaps also works on Linux
0
 
LVL 13

Assisted Solution

by:Hugh McCurdy
Hugh McCurdy earned 280 total points
ID: 36922368
I tested Linux & Win7.  I couldn't figure out how to determine # bits in Win7 even after trying different things.  I'm going to have to give up.

My guess, from the lack of documentation, is it doesn't matter much.
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36922395
how about
java -Xmx2000M -version
in case of 64bit ?
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 120 total points
ID: 36922865
In what context do you want to find out - in a script, inside a java app ..?
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36922891

in java program it should be doable with this
 System.getProperty("sun.arch.data.model")

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 36923044
Yes - you mentioned that already...
0
 
LVL 10

Assisted Solution

by:gordon_vt02
gordon_vt02 earned 400 total points
ID: 36925373
Yes and no to your question about java -version.  It will report the version for whichever JDK is first on your PATH, and it is possible and likely that you have both the 64- and 32-bit versions installed, especially since most browsers are 32-bit and would require the 32-bit Java Plugin.

If you run java -version and 64-bit appears, yes, you have a 64-bit JDK installed.  If it doesn't, check in c:\Program Files\Java and see if there is a JDK installed there.  If so, try going to that JDK's bin directory and running .\java.exe -version and see if it gives you 64-bit.  If not, you only have the 32-bit installed.

A simple visual check might tell you as well -- the default location for JDK installs on 64-bit Windows is:

32-bit: c:\Program Files (x86)\Java\<jdk|jre_version>
64-bit: c:\Program Files\Java\<jdk|jre_version>
0
 

Author Comment

by:asugri
ID: 36928469

java -d64 does not work on Windows.
java -Xmx2000M -version  to test memory limit is interesting.

We are developing a package using java.  This package uses a dll file.  
32-bit java needs 32-bit dll and 64-bit java needs 64-bit dll.   We are
planning to test out version of java from InstallShield and determine
which dll to provide.   But I think System.getProperty("sun.arch.data.model")
is good since I just load different dll based on value returned by
System.getProperty("sun.arch.data.model").

Thanks a lot for the help.

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month12 days, 2 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question