Java JVM is 64 Bit is64Bit()

Here you can find the source of is64Bit()

Description

is Bit

License

MIT License

Return

True if the underlying platform is 64-bit (i.e. correctly detects a 32-bit JRE on a 64-bit Windows install as 64-bit)

Declaration

public static boolean is64Bit() 

Method Source Code

//package com.java2s;
/**//w  ww.  j  a  v a2 s  . c  o m
 * Copyright 2011 multibit.org
 *
 * Licensed under the MIT license (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://opensource.org/licenses/mit-license.php
 *
 * 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 {
    /**
     * @return True if the underlying platform is 64-bit (i.e. correctly detects a 32-bit JRE on a 64-bit Windows install as 64-bit)
     */
    public static boolean is64Bit() {

        boolean result;
        if (System.getProperty("os.name").contains("Windows")) {
            result = (System.getenv("ProgramFiles(x86)") != null);
        } else {
            result = (System.getProperty("os.arch").contains("64"));
        }

        return result;
    }
}

Related

  1. is64Bit()
  2. is64Bit()
  3. is64Bit()
  4. is64Bit()