JAL-3631 Add PID to console info - only available in Java 9+
authorBen Soares <b.soares@dundee.ac.uk>
Mon, 29 Jul 2024 18:04:49 +0000 (19:04 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Mon, 29 Jul 2024 18:04:49 +0000 (19:04 +0100)
src/jalview/bin/Cache.java

index f79c265..681394f 100755 (executable)
@@ -68,6 +68,7 @@ import jalview.urls.IdOrgSettings;
 import jalview.util.ChannelProperties;
 import jalview.util.ColorUtils;
 import jalview.util.HttpUtils;
+import jalview.util.LaunchUtils;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
 import jalview.ws.sifts.SiftsSettings;
@@ -1273,6 +1274,14 @@ public class Cache
       sb.append(" (");
       sb.append(lafClass);
       sb.append(")\n");
+      // pid() only available in Java 9+
+      if (LaunchUtils.getJavaVersion() > 8)
+      {
+        sb.append("Java Virtual Machine PID: ");
+        sb.append(ProcessHandle.current().pid());
+        sb.append("\n");
+      }
+
     }
     appendIfNotNull(sb, "Installer version: ",
             System.getProperty("sys.install4jVersion"), "\n", null);