The fact is that in my application, depending on the bitness of the OS, you need to call different methods. Actually, the question arose: how can I use the java-code to find out the OS bit capacity?

  • Here you are offered to launch systeminfo and see. - KoVadim

2 answers 2

Here is a piece of code from the working application:

String osName = System.getProperty("os.name").toLowerCase(); String osArch = System.getProperty("os.arch").toLowerCase(); String swtFileName = osName.contains("win") ? "win" : osName.contains("mac") ? "macosx" : // osName.contains("linux") || osName.contains("nix") ? "linux_gtk" : // Linux version is to come yet null; if (swtFileName == null) throw new RuntimeException("Unknown OS name: "+osName); swtFileName += osArch.contains("64") ? "64" : "32"; swtVersion = swtFileName; swtFileName = "swt_" + swtFileName + ".jar"; 

    The operating system version can be obtained through the list of system properties :

     String version = System.getProperty("os.arch");