Java JVM is 64 Bit is64BitJVM()

Here you can find the source of is64BitJVM()

Description

Returns true if the current Java VM runs with a 64 bit architecture.

License

Apache License

Declaration

public static boolean is64BitJVM() 

Method Source Code

//package com.java2s;
/*-------------------------------------------------------------------------+
|                                                                          |
| Copyright 2005-2011 the ConQAT Project                                   |
|                                                                          |
| Licensed under the Apache License, Version 2.0 (the "License");          |
| you may not use this file except in compliance with the License.         |
| You may obtain a copy of the License at                                  |
|                                                                          |
|    http://www.apache.org/licenses/LICENSE-2.0                            |
|                                                                          |
| Unless required by applicable law or agreed to in writing, software      |
| distributed under the License is distributed on an "AS IS" BASIS,        |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and      |
| limitations under the License.                                           |
+-------------------------------------------------------------------------*/

public class Main {
    /**//  w w  w.  j  av  a  2 s.  c  o  m
     * Returns <code>true</code> if the current Java VM runs with a 64 bit
     * architecture. E.g. will return <code>false</code> for a 32 bit JVM on a
     * 64 bit operating system.
     */
    public static boolean is64BitJVM() {
        return getJVMArchitectureName().contains("64");
    }

    /**
     * Returns the architecture name of the Java VM. This is neither returns the
     * architecture of the processor nor the architecture of the operating
     * system, although the property is prefixed with 'os.' (@see <a href=
     * "http://mark.koli.ch/javas-osarch-system-property-is-the-bitness-of-the-jre-not-the-operating-system"
     * >this site</a> for more information). I.e. running a 32 bit JVM on a 64
     * bit Windows operating system will return 'x86'.
     */
    public static String getJVMArchitectureName() {
        return System.getProperty("os.arch");
    }
}

Related

  1. is64BitJavaOnMac()
  2. is64BitJavaOnMac()
  3. is64BitJre()
  4. is64BitJVM()
  5. is64bitJVM()