I want to know the OS type, means is it of 64bit os or 32bit os. But I am getting different response from 32bit/64bit executable which getting system properties about OS
I am getting details from system property. and I have 64bit machine and OS windows 8.1 X64
"OS Architecture : " + System.getProperty("os.arch"));
"OS Name : " + System.getProperty("os.name"));
"OS Version : " + System.getProperty("os.version")
"Data Model : " + System.getProperty("sun.arch.data.model"));
OS Architecture : amd64
OS Name : Windows 8
OS Version : 6.2 amd64
Data Model : 64
OS Architecture : x86
OS Name : Windows 8
OS Version : 6.2 x86
Data Model : 32
How can I get OS actual bit type ?
Look for "lm" in the command output. If lm is found in the output, then the CPU is 64-bit. If you don't see lm or see i386, i486, i586, or i686 in the output, then the CPU is 32-bit.
Click Start, type system in the search box, and then click System in the Control Panel list. The operating system is displayed as follows: For a 64-bit version operating system: 64-bit Operating System appears for the System type under System.
System.getProperty("os.arch") will always return the bit type of the jre and not of the actual operating system.
Write jni code and calll IsWow64Process
from winapi. Since you are using windows.
This boolean function tells you whether the process is running on 64-bit os.
This should help you
System.getProperty("os.arch");
will return "x86" when the architecture of JRE is 32 bit. We have to write native code to get the real architecture of the system using JNI.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With