Tutorial :Retrieve Architecture from Java



Question:

I'm writing a JNI application and I want the app to download the correct binary library for the current architecture. Is there any way to retrieve this information from code?

I need to know where it's ARM, x86 or any other architecture really.

Kind regards,

Gavin


Solution:1

java.lang.System.getProperty("os.arch") should help -- giving "arm", "amd64", and the like.


Solution:2

System.getProperty("os.arch")  

http://www.roseindia.net/java/beginners/OSInformation.shtml


Solution:3

This works in 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"));       }  }  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »