2009-06-15 38 views
0

我正在编写JNI应用程序,我希望应用程序为当前体系结构下载正确的二进制库。有没有办法从代码中检索这些信息?从Java检索体系结构

我需要知道它是ARM,x86还是其他任何架构。

亲切的问候,

加文

回答

4

java.lang.System.getProperty("os.arch")应该帮助 - 让 “手臂”, “AMD64”等等。

0

此作品在Java中6SE:

 
public class ListProperties 
{ 
    public static void main(String[] argv) 
    { 
     System.getProperties().list(System.out); 
     // These are only examples of obtaining specific properties 
     System.out.println(System.getProperty("user.name")); 
     System.out.println(System.getProperty("java.library.path")); 
    } 
}