I need latest compilation of all possible values of the os.arch property in JRE 1.6 on Linux,Solaris and Windows. If possible please Quote the source of your findings. I need this values to select resources in my JNLP file. Basically I need to assign different JVM memory based on whether the JRE is 32bit or 64bit. Waiting for your answer. Thanks
3 Answers
The best place where you can look for this it's in the own jdk.
Looking on java.lang.System
you can see that the properties are initialized in initializeSystemClass
method using initProperties
method which relies on native code using JNI
:
private static native Properties initProperties(Properties props);
/**
* Initialize the system class. Called after thread initialization.
*/
private static void initializeSystemClass() {
// VM might invoke JNU_NewStringPlatform() to set those encoding
// sensitive properties (user.home, user.name, boot.class.path, etc.)
// during "props" initialization, in which it may need access, via
// System.getProperty(), to the related system encoding property that
// have been initialized (put into "props") at early stage of the
// initialization. So make sure the "props" is available at the
// very beginning of the initialization and all system properties to
// be put into it directly.
props = new Properties();
initProperties(props); // initialized by the VM
...
...
}
If you check the source of this native code called from initProperties
for the different platforms you can see the possible values for os.arch
system property. So do it step by step:
First look at System.c
to see the JNI
method called from java.lang.System.initProperties
. From System.c
JNIEXPORT jobject JNICALL
Java_java_lang_System_initProperties(JNIEnv *env, jclass cla, jobject props)
{
char buf[128];
java_props_t *sprops = GetJavaProperties(env);
jmethodID putID = (*env)->GetMethodID(env,
(*env)->GetObjectClass(env, props),
"put",
"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
if (sprops == NULL || putID == NULL ) return NULL;
PUTPROP(props, "java.specification.version",
JDK_MAJOR_VERSION "." JDK_MINOR_VERSION);
PUTPROP(props, "java.specification.name",
"Java Platform API Specification");
PUTPROP(props, "java.specification.vendor", "Sun Microsystems Inc.");
PUTPROP(props, "java.version", RELEASE);
PUTPROP(props, "java.vendor", VENDOR);
PUTPROP(props, "java.vendor.url", VENDOR_URL);
PUTPROP(props, "java.vendor.url.bug", VENDOR_URL_BUG);
...
/* os properties */
PUTPROP(props, "os.name", sprops->os_name);
PUTPROP(props, "os.version", sprops->os_version);
// HERE IS THE `os.arch` PROPERTY :)
PUTPROP(props, "os.arch", sprops->os_arch);
So as you can see the os.arch
comes from PUTPROP(props, "os.arch", sprops->os_arch);
and the sprops
it's achieved using java_props_t *sprops = GetJavaProperties(env);
. so lets look at GetJavaProperties(env)
, this method it's defined in java_props.h
as:
java_props_t *GetJavaProperties(JNIEnv *env);
And the implementation seems that depends on OS.
So finally looking a specific implementation for GetJavaProperties
;
in Windows the possible values which this property can take are ia64
, amd64
, x86
, or unknown
. You can see from java_props_md.c
file :
#if _M_IA64
sprops.os_arch = "ia64";
#elif _M_AMD64
sprops.os_arch = "amd64";
#elif _X86_
sprops.os_arch = "x86";
#else
sprops.os_arch = "unknown";
#endif
For Solaris seems more complicated since the property value in the native code comes from a Macro defined in the java_props_md.c
specific for solaris as:
sprops.os_arch = ARCHPROPNAME;
And this Macro it's defined in the follow Makefile
as:
OTHER_CPPFLAGS += -DARCHPROPNAME='"$(ARCHPROP)"'
So it looks like this comes from the environment, where it's compiled (sorry I'm not a C expert, I'm just guessing however maybe I can guide you a bit).
In the Linux folder in src/linux/native/
there is no java_props_md.c
so I suppose that in this case take the same source as solaris (I'm guessing again...).
NOTE: I use the 1.6 version to get this values, however new values can will be added in newest java versions, so check your required version.
Hope it helps,

- 18,112
- 4
- 64
- 89
-
1Although this isn't a complete solution I gave it the bounty because you made the effort to look for the canonical values. Note: For historical reasons, in Java before jdk9 the Solaris folder has most of the generic Unix stuff, so yeah, that code would apply to Linux. It's unfortunate if the value comes from the environment because that means its value is *open-ended*. I'd hoped for a tidy, canonical table of possible values without need for superstitious inclusion of lots of architecture synonyms, but maybe that is impossible. – Boann May 04 '16 at 23:47
-
@Boann thanks for the confirmation about solaris and linux. At first I'm look at documentation to see the possible values for `os.arch` but it seems that there is no official information about it... so then I look directly in the code; unfortunately this also doesn't give the information we're looking for. Anyway thanks for the bounty `:)`. – albciff May 05 '16 at 06:13
I ran into the same problem in 2019. Especially with regard to arm processors.
After trying it out, the raspberry pi 2 (ARMv7) seems to simply return the string arm
.
The raspberry pi 3 (ARMv8) returns aarch64
.
x86 64-bit desktops and servers return amd64
.
Hope this helps someone.

- 28,965
- 9
- 65
- 105
You can also write some code like below to find out os and its archi.
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang.SystemUtils;
public class PlatformDetection {
private String os;
private String arch;
public static String OS_WINDOWS = "windows";
public static String OS_OSX = "osx";
public static String OS_SOLARIS = "solaris";
public static String OS_LINUX = "linux";
public static String ARCH_PPC = "ppc";
public static String ARCH_X86_32 = "x86_32";
public static String ARCH_X86_64 = "x86_64";
public PlatformDetection() {
// resolve OS
if (SystemUtils.IS_OS_WINDOWS) {
this.os = OS_WINDOWS;
} else if (SystemUtils.IS_OS_MAC_OSX) {
this.os = OS_OSX;
} else if (SystemUtils.IS_OS_SOLARIS) {
this.os = OS_SOLARIS;
} else if (SystemUtils.IS_OS_LINUX) {
this.os = OS_LINUX;
} else {
throw new IllegalArgumentException("Unknown operating system " + SystemUtils.OS_NAME);
}
// resolve architecture
Map<String, String> archMap = new HashMap<String, String>();
archMap.put("x86", ARCH_X86_32);
archMap.put("i386", ARCH_X86_32);
archMap.put("i486", ARCH_X86_32);
archMap.put("i586", ARCH_X86_32);
archMap.put("i686", ARCH_X86_32);
archMap.put("x86_64", ARCH_X86_64);
archMap.put("amd64", ARCH_X86_64);
archMap.put("powerpc", ARCH_PPC);
this.arch = archMap.get(SystemUtils.OS_ARCH);
if (this.arch == null) {
throw new IllegalArgumentException("Unknown architecture " + SystemUtils.OS_ARCH);
}
}
public String getOs() {
return os;
}
public String getArch() {
return arch;
}
public void setArch(String arch) {
this.arch = arch;
}
public void setOs(String os) {
this.os = os;
}
public String toString() {
return os + "_" + arch;
}
}
Refer below Links

- 1,977
- 3
- 19
- 39
-
1I didn't give this answer the bounty because it's not clear how reliable the links are. They detect different `os.arch` values for some of the same architectures (e.g. `powerpc` vs `ppc`), and it's not clear whether they know that the values can occur or if it is superstitious coding. Also you copy-pasted one of them here and I don't know what its copyright status is. – Boann May 04 '16 at 23:47