Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>System.getProperty("os.arch"); </code></pre> <p>Should be available on all platforms, see the Java <a href="http://download.oracle.com/javase/tutorial/essential/environment/sysprop.html" rel="nofollow noreferrer">System Properties Tutorial</a> for more information.</p> <p><strong>But</strong> 64 bit Windows platforms will lie to the JVM if it is a 32 bit JVM. Actually 64 bit Windows will lie to any 32 bit process about the environment to help old 32 bit programs work properly on a 64 bit OS. Read the <a href="http://msdn.microsoft.com/en-us/library/aa384249%28v=vs.85%29.aspx" rel="nofollow noreferrer">MSDN article about WOW64</a> for more information.</p> <p>As a result of WOW64, a 32 bit JVM calling <code>System.getProperty("os.arch")</code> will return "x86". If you want to get the <em>real</em> architecture of the underlying OS on Windows, use the following logic:</p> <pre><code>String arch = System.getenv("PROCESSOR_ARCHITECTURE"); String wow64Arch = System.getenv("PROCESSOR_ARCHITEW6432"); String realArch = arch != null &amp;&amp; arch.endsWith("64") || wow64Arch != null &amp;&amp; wow64Arch.endsWith("64") ? "64" : "32"; </code></pre> <p>See also:</p> <p><a href="http://blogs.msdn.com/b/david.wang/archive/2006/03/26/howto-detect-process-bitness.aspx" rel="nofollow noreferrer">HOWTO: Detect Process Bitness</a></p> <p><a href="https://stackoverflow.com/questions/1738985/why-processor-architecture-always-returns-x86-instead-of-amd64">Why %processor_architecture% always returns x86 instead of AMD64</a></p> <p><a href="https://stackoverflow.com/questions/601089/detect-whether-current-windows-version-is-32-bit-or-64-bit">Detect whether current Windows version is 32 bit or 64 bit</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload