views:

175

answers:

1

Is there any way to detect a 64-bit java install in a 32-bit environment? The Java Deployment Toolkit detects nothing, but I was wondering if there was some secret browser way of detecting the 64-bit install client-side.

+2  A: 

Sun's HotSpot JVM FAQ:

When writing Java code, how do I distinguish between 32 and 64-bit operation?

There's no public API that allows you to distinguish between 32 and 64-bit operation. Think of 64-bit as just another platform in the write once, run anywhere tradition. However, if you'd like to write code which is platform specific (shame on you), the system property sun.arch.data.model has the value "32", "64", or "unknown".

You can access this like System.getProperty("sun.arch.data.model"). This property will obviously only actually be set on Sun JVMs/JREs.

You might also try to parse the results of System.getProperty("java.vm.name"), but this will also be highly vendor specific.

matt b
I guess I could do this in an applet, but I was hoping to get this information before java was necessarily loaded or available.
Stefan Kendall