From 1f6504bd0b7187c99cd4a2551c15e854d14583b5 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Tue, 21 May 2019 18:15:53 +0100 Subject: [PATCH] JAL-3247 Launcher start improvements. RPM and DEB no longer packaged with getdown (due to difficulties) --- src/jalview/bin/Jalview.java | 6 +- src/jalview/bin/JalviewTaskbar.java | 2 +- src/jalview/bin/Launcher.java | 36 ++++- src/jalview/gui/APQHandlers.java | 4 +- src/jalview/gui/Desktop.java | 8 +- utils/install4j/install4j_template.install4j | 192 ++++++++++++++++++++------ 6 files changed, 191 insertions(+), 57 deletions(-) diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index c66e63e..449c1fb 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -360,10 +360,12 @@ public class Jalview JalviewTaskbar.setTaskbar(this); } catch (Exception e) { - e.printStackTrace(); + System.out.println("Cannot set Taskbar"); + // e.printStackTrace(); } catch (Throwable t) { - t.printStackTrace(); + System.out.println("Cannot set Taskbar"); + // t.printStackTrace(); } desktop.setVisible(true); diff --git a/src/jalview/bin/JalviewTaskbar.java b/src/jalview/bin/JalviewTaskbar.java index 5747263..7dd0382 100644 --- a/src/jalview/bin/JalviewTaskbar.java +++ b/src/jalview/bin/JalviewTaskbar.java @@ -29,7 +29,7 @@ public class JalviewTaskbar } } catch (Exception e) { - e.printStackTrace(); + System.out.println("Unable to setIconImage()"); } } } diff --git a/src/jalview/bin/Launcher.java b/src/jalview/bin/Launcher.java index 9957a40..412f119 100644 --- a/src/jalview/bin/Launcher.java +++ b/src/jalview/bin/Launcher.java @@ -12,6 +12,8 @@ public class Launcher private final static int maxHeapSizePerCent = 90; + private final static String maxHeapSizePerCentProperty = "jvmmempc"; + private final static String dockIconPath = "JalviewLogo_Huge.png"; public static void main(String[] args) @@ -22,6 +24,8 @@ public class Launcher ArrayList command = new ArrayList<>(); command.add(javaBin); + String memSetting = null; + boolean isAMac = System.getProperty("os.name").indexOf("Mac") > -1; for (String jvmArg : ManagementFactory.getRuntimeMXBean() @@ -46,6 +50,7 @@ public class Launcher String arg = command.get(i); if (arg.startsWith("-Xmx")) { + memSetting = arg; memSet = true; } else if (arg.startsWith("-Xdock:icon")) @@ -61,10 +66,32 @@ public class Launcher if (!memSet) { long maxMemLong = -1; + int percent = maxHeapSizePerCent; + String jvmmempc = System.getProperty(maxHeapSizePerCentProperty); + try + { + if (jvmmempc != null) + { + int trypercent = Integer.parseInt(jvmmempc); + if (0 < trypercent && trypercent <= 100) + { + percent = trypercent; + } + else + { + System.out.println("Property '" + maxHeapSizePerCentProperty + + "' should be in range 1..100"); + } + } + } catch (Exception e) + { + System.out.println("Error parsing " + maxHeapSizePerCentProperty + + " '" + jvmmempc + "'"); + } try { - maxMemLong = MemorySetting.memPercent(maxHeapSizePerCent); + maxMemLong = MemorySetting.memPercent(percent); } catch (Exception e) { e.printStackTrace(); @@ -75,7 +102,8 @@ public class Launcher if (maxMemLong > 0) { - command.add("-Xmx" + Long.toString(maxMemLong)); + memSetting = "-Xmx" + Long.toString(maxMemLong); + command.add(memSetting); } } @@ -98,7 +126,9 @@ public class Launcher final ProcessBuilder builder = new ProcessBuilder(command); - System.out.println("COMMAND: " + String.join(" ", builder.command())); + // System.out.println("COMMAND: " + String.join(" ", builder.command())); + System.out.println("Running " + startClass + " with " + + (memSetting == null ? "no memSetting" : memSetting)); try { diff --git a/src/jalview/gui/APQHandlers.java b/src/jalview/gui/APQHandlers.java index 31f7a6d..f22d048 100644 --- a/src/jalview/gui/APQHandlers.java +++ b/src/jalview/gui/APQHandlers.java @@ -134,12 +134,12 @@ public class APQHandlers { System.out.println( "Exception when looking for About, Preferences, Quit Handlers"); - e.printStackTrace(); + // e.printStackTrace(); } catch (Throwable t) { System.out.println( "Throwable when looking for About, Preferences, Quit Handlers"); - t.printStackTrace(); + // t.printStackTrace(); } } diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 41cbad8..98584bc 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -366,12 +366,12 @@ public class Desktop extends jalview.jbgui.GDesktop APQHandlers.setAPQHandlers(this); } catch (Exception e) { - System.out.println("Exception when trying to set APQHandlers"); - e.printStackTrace(); + System.out.println("Cannot set APQHandlers"); + // e.printStackTrace(); } catch (Throwable t) { - System.out.println("Throwable when trying to set APQHandlers"); - t.printStackTrace(); + System.out.println("Cannot set APQHandlers"); + // t.printStackTrace(); } diff --git a/utils/install4j/install4j_template.install4j b/utils/install4j/install4j_template.install4j index f8e9c98..f6a0051 100644 --- a/utils/install4j/install4j_template.install4j +++ b/utils/install4j/install4j_template.install4j @@ -1,5 +1,5 @@ - + @@ -27,17 +27,20 @@ + + + @@ -52,6 +55,9 @@ + + + + @@ -151,6 +164,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -702,6 +748,36 @@ return console.askOkCancel(message, true); + + + + + + false + + + ${compiler:sys.shortName} + + + + ${compiler:sys.shortName} + + + + + ../../resources/images/jalview_logos.ico + + + + + ../../resources/images/JalviewLogo_Huge.png + + + + + + !context.getBooleanVariable("sys.programGroupDisabled") + @@ -1448,7 +1524,7 @@ return console.askYesNo(message, true); - + 255 @@ -1478,19 +1554,21 @@ return console.askYesNo(message, true); icon:${installer:sys.installerApplicationMode}_header.png + + - 0 + 5 - 1 - 1 + + - 0 + 20 - 0 + 10 @@ -1572,16 +1650,17 @@ return console.askYesNo(message, true); - + false + 3 - 5 + 8 - 5 + @@ -1668,20 +1747,23 @@ return console.askYesNo(message, true); - + + + + @@ -1703,20 +1785,23 @@ return console.askYesNo(message, true); - + + + + @@ -1743,6 +1828,7 @@ return console.askYesNo(message, true); + @@ -1753,6 +1839,30 @@ return console.askYesNo(message, true); + + + + + + + + + + + + + + + + + + + + + + + + @@ -1764,6 +1874,7 @@ return console.askYesNo(message, true); + @@ -1771,6 +1882,7 @@ return console.askYesNo(message, true); + @@ -1790,6 +1902,7 @@ return console.askYesNo(message, true); + @@ -1797,6 +1910,7 @@ return console.askYesNo(message, true); + @@ -1817,6 +1931,7 @@ return console.askYesNo(message, true); + @@ -1828,6 +1943,7 @@ return console.askYesNo(message, true); + @@ -1838,34 +1954,12 @@ return console.askYesNo(message, true); - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -1874,42 +1968,49 @@ return console.askYesNo(message, true); + + - - + + + + + - + + - + + + - + + - - - - + + @@ -1919,6 +2020,7 @@ return console.askYesNo(message, true); + -- 1.7.10.2