source: main/trunk/search4j/DisplayJavaBitness.java@ 36214

Last change on this file since 36214 was 35457, checked in by davidb, 3 years ago

Addition of java-based solution to more cleanly determine Java version and bitness, rather than relying of it's 'version' minus argument and inspecting with 'file' the 'java' program. This commit for Unix OS. A later phase of work will be the updated win32.mak file for Windows. Then a final phase of work will be for the 'search4j' source code to be tied in with the generated jar files

File size: 613 bytes
Line 
1class DisplayJavaBitness
2{
3 public static void main(String args[])
4 {
5 boolean verbose = false;
6
7 if (args.length == 1) {
8 String arg0 = args[0];
9
10 if (arg0.equals("-v") || arg0.equals("-verbose") || arg0.equals("--verbose")) {
11 verbose = true;
12 }
13 }
14
15 // Testing bitness of JVM
16 // https://www.baeldung.com/java-detect-jvm-64-or-32-bit
17
18
19 boolean is_64bit = com.sun.jna.Platform.is64Bit();
20
21 String bitness_str = (is_64bit) ? "64" : "32";
22
23 if (verbose) {
24 System.out.println("Bitness: " + bitness_str + "bit");
25 }
26 else {
27 System.out.println(bitness_str);
28 }
29 }
30}
31
Note: See TracBrowser for help on using the repository browser.