From: Ben Soares Date: Mon, 1 Apr 2019 08:53:21 +0000 (+0100) Subject: JAL-3130 JAL-3007 Added gradle build for Java 11 and additional taskbar icon change... X-Git-Tag: Release_2_11_0~17^2~7^2~52 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e2e71a31f26f128c939d2ca2758a897f28174a37;p=jalview.git JAL-3130 JAL-3007 Added gradle build for Java 11 and additional taskbar icon change in jalview.bin.Jalview --- diff --git a/.gitignore b/.gitignore index 211ddc9..eea1c5e 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,12 @@ TESTNG /benchmarking/lib *.class /site +/gradle/jalview/build +/gradle/jalview/.gradle +/.gradle +/utils/HelpLinksChecker.out +/.settings +/getdown/website +/getdown/full_app +/getdown/files +/.classpath diff --git a/getdown/lib/getdown-core-1.8.3-SNAPSHOT.jar b/getdown/lib/getdown-core-1.8.3-SNAPSHOT.jar new file mode 100644 index 0000000..ed61abf Binary files /dev/null and b/getdown/lib/getdown-core-1.8.3-SNAPSHOT.jar differ diff --git a/getdown/lib/getdown-launcher.jar b/getdown/lib/getdown-launcher.jar new file mode 100644 index 0000000..f39be5b Binary files /dev/null and b/getdown/lib/getdown-launcher.jar differ diff --git a/resources/images/jalview_logo_background_fade-640x480.png b/resources/images/jalview_logo_background_fade-640x480.png new file mode 100644 index 0000000..4b65200 Binary files /dev/null and b/resources/images/jalview_logo_background_fade-640x480.png differ diff --git a/resources/images/jalview_logos.ico b/resources/images/jalview_logos.ico new file mode 100644 index 0000000..ba2ca82 Binary files /dev/null and b/resources/images/jalview_logos.ico differ diff --git a/resources/install4j/DS_Store b/resources/install4j/DS_Store new file mode 100644 index 0000000..374da46 Binary files /dev/null and b/resources/install4j/DS_Store differ diff --git a/resources/install4j/jalview_dmg_background.png b/resources/install4j/jalview_dmg_background.png new file mode 100644 index 0000000..139fb2b Binary files /dev/null and b/resources/install4j/jalview_dmg_background.png differ diff --git a/resources/install4j/jalview_dmg_background.xcf b/resources/install4j/jalview_dmg_background.xcf new file mode 100644 index 0000000..aab616a Binary files /dev/null and b/resources/install4j/jalview_dmg_background.xcf differ diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index cc41c53..cda02fc 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -41,6 +41,8 @@ import jalview.util.MessageManager; import jalview.util.Platform; import jalview.ws.jws2.Jws2Discoverer; +import java.awt.Image; +import java.awt.Taskbar; import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; @@ -335,6 +337,29 @@ public class Jalview { desktop = new Desktop(); desktop.setInBatchMode(true); // indicate we are starting up + + if (Taskbar.isTaskbarSupported()) + { + Taskbar tb = Taskbar.getTaskbar(); + if (tb.isSupported(Taskbar.Feature.ICON_IMAGE)) + { + try + { + java.net.URL url = getClass() + .getResource("/images/JalviewLogo_Huge.png"); + if (url != null) + { + Image image = java.awt.Toolkit.getDefaultToolkit() + .createImage(url); + tb.setIconImage(image); + } + } catch (Exception e) + { + e.printStackTrace(); + } + } + } + desktop.setVisible(true); desktop.startServiceDiscovery(); if (!aparser.contains("nousagestats")) diff --git a/src/jalview/bin/Launcher.java b/src/jalview/bin/Launcher.java new file mode 100644 index 0000000..b595b4f --- /dev/null +++ b/src/jalview/bin/Launcher.java @@ -0,0 +1,119 @@ +package jalview.bin; + +import java.io.File; +import java.lang.management.ManagementFactory; +import java.lang.management.OperatingSystemMXBean; +import java.util.ArrayList; + +public class Launcher +{ + + private final static String startClass = "jalview.bin.Jalview"; + + private final static int maxHeapSizePerCent = 95; + + private final static String dockIconPath = "JalviewLogo_Huge.png"; + + public static void main(String[] args) + { + final String javaBin = System.getProperty("java.home") + File.separator + + "bin" + File.separator + "java"; + + ArrayList command = new ArrayList<>(); + command.add(javaBin); + + boolean isAMac = System.getProperty("os.name").indexOf("Mac") > -1; + + for (String jvmArg : ManagementFactory.getRuntimeMXBean() + .getInputArguments()) + { + command.add(jvmArg); + } + command.add("-cp"); + command.add(ManagementFactory.getRuntimeMXBean().getClassPath()); + ArrayList arguments = new ArrayList<>(); + for (String arg : args) + { + arguments.add(arg); + } + + // add memory setting if not specified + boolean memSet = false; + boolean dockIcon = false; + ARG: for (int i = 0; i < command.size(); i++) + { + String arg = command.get(i); + if (arg.startsWith("-Xmx")) + { + memSet = true; + } + else if (arg.startsWith("-Xdock:icon")) + { + dockIcon = true; + } + } + + if (!memSet) + { + long maxMemLong = -1; + long physicalMem = getPhysicalMemory(); + if (physicalMem > 0) + { + maxMemLong = physicalMem * maxHeapSizePerCent / 100; + } + if (maxMemLong > 0) + { + command.add("-Xmx" + Long.toString(maxMemLong)); + } + } + + if (!dockIcon) + { + command.add("-Xdock:icon=" + dockIconPath); + // -Xdock:name=... doesn't actually work :( + // Leaving it in in case it gets fixed + command.add("-Xdock:name=" + "Jalview"); + } + + command.add(startClass); + command.addAll(arguments); + + final ProcessBuilder builder = new ProcessBuilder(command); + + System.out.println("COMMAND: " + String.join(" ", builder.command())); + + try + { + builder.inheritIO(); + builder.start(); + } catch (Exception e) + { + e.printStackTrace(); + } + // System.exit(0); + + } + + public static long getPhysicalMemory() + { + final OperatingSystemMXBean o = ManagementFactory + .getOperatingSystemMXBean(); + + try + { + if (o instanceof com.sun.management.OperatingSystemMXBean) + { + final com.sun.management.OperatingSystemMXBean osb = (com.sun.management.OperatingSystemMXBean) o; + return osb.getTotalPhysicalMemorySize(); + } + } catch (NoClassDefFoundError e) + { + // com.sun.management.OperatingSystemMXBean doesn't exist in this JVM + System.out.println("No com.sun.management.OperatingSystemMXBean"); + } + + // We didn't get a com.sun.management.OperatingSystemMXBean. + return -1; + } + +}