From 1d71f9b87df3ced4e7375ab8969ac49a07f51778 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Wed, 7 Feb 2018 09:55:17 -0600 Subject: [PATCH 1/6] Replace native splash with Java implementation This removes the native implementation that was hard to maintain in the past and wasn't working properly in some cases. In addition, changes to how libsplashscreen is linked starting with Java 9 has made using libjvm basically impossible. The new Java implementation offers a progress bar during startup which is currently static. Future versions could improve on this and make the startup even more verbose s.t. we can get more information on where it grinds to a halt / an issue appears. --- pom.xml | 2 +- src/main/c/ImageJ.c | 14 +- src/main/c/platform.c | 2 - src/main/c/splash.c | 124 ------------------ src/main/include/splash.h | 48 ------- .../net/imagej/launcher/ClassLauncher.java | 3 + .../net/imagej/launcher/SplashScreen.java | 124 ++++++++++++++++++ 7 files changed, 132 insertions(+), 185 deletions(-) delete mode 100644 src/main/c/splash.c delete mode 100644 src/main/include/splash.h create mode 100644 src/main/java/net/imagej/launcher/SplashScreen.java diff --git a/pom.xml b/pom.xml index 098079a5..eaa5d769 100644 --- a/pom.xml +++ b/pom.xml @@ -129,7 +129,7 @@ Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. ImageJ software for multidimensional image processing and analysis. - 1.6 + 1.8 diff --git a/src/main/c/ImageJ.c b/src/main/c/ImageJ.c index a233b599..39a1fb3a 100644 --- a/src/main/c/ImageJ.c +++ b/src/main/c/ImageJ.c @@ -73,7 +73,6 @@ #include "file-funcs.h" #include "java.h" #include "platform.h" -#include "splash.h" #include "string-funcs.h" #include "xalloc.h" @@ -198,7 +197,6 @@ static void maybe_reexec_with_correct_lib_path(struct string *java_library_path) setenv_or_exit("LD_LIBRARY_PATH", java_library_path->buffer, 1); if (debug) error("Re-executing with correct library lookup path (%s)", java_library_path->buffer); - hide_splash(); execvp(main_argv_backup[0], main_argv_backup); die("Could not re-exec with correct library lookup (%d: %s)!", errno, strerror(errno)); #elif defined(__APPLE__) @@ -214,7 +212,6 @@ static void maybe_reexec_with_correct_lib_path(struct string *java_library_path) setenv_or_exit("DYLD_LIBRARY_PATH", java_library_path->buffer, 1); if (debug) error("Re-executing with correct library lookup path (%s)", java_library_path->buffer); - hide_splash(); execvp(main_argv_backup[0], main_argv_backup); die("Could not re-exec with correct library lookup: %d (%s)", errno, strerror(errno)); #endif @@ -1206,8 +1203,6 @@ static void try_with_less_memory(long megabytes) if (debug) error("Trying with a smaller heap: %s", buffer->buffer); - hide_splash(); - #ifdef WIN32 new_argv[0] = dos_path(new_argv[0]); for (i = 0; i < j; i++) @@ -1285,6 +1280,7 @@ static struct options options; static long megabytes = 0; static struct string buffer, buffer2, arg, plugin_path; static int jdb, advanced_gc = 1, debug_gc; +static int splash = 1; static int allow_multiple, skip_class_launcher, full_class_path; static int dont_patch_ij1; @@ -1499,7 +1495,7 @@ static int handle_one_option2(int *i, int argc, const char **argv) add_option_string(&options, &arg, 0); } else if (!strcmp("--no-splash", argv[*i])) - disable_splash(); + splash = 0; else if (!strcmp("--help", argv[*i]) || !strcmp("-h", argv[*i])) usage(); @@ -1774,8 +1770,8 @@ static void parse_command_line(void) maybe_reexec_with_correct_lib_path(java_library_path); - if (!options.dry_run && !options.use_system_jvm && !headless && (is_default_ij1_class(main_class) || !strcmp(default_main_class, main_class))) - show_splash(imagej_launcher_jar); + if (splash && !options.dry_run && !options.use_system_jvm && !headless && (is_default_ij1_class(main_class) || !strcmp(default_main_class, main_class))) + add_option(&options, "-Dimagej.splash=true", 0); /* set up class path */ if (full_class_path || !strcmp(default_main_class, main_class)) { @@ -2197,7 +2193,6 @@ int start_ij(void) args = prepare_ij_options(env, &options.ij_options); (*env)->CallStaticVoidMethodA(env, instance, method, (jvalue *)&args); - hide_splash(); if ((*vm)->DetachCurrentThread(vm)) error("Could not detach current thread"); /* This does not return until ImageJ exits */ @@ -2249,7 +2244,6 @@ int start_ij(void) #endif } options.java_options.list[0] = buffer->buffer; - hide_splash(); #ifndef WIN32 if (execvp(buffer->buffer, options.java_options.list)) error("Could not launch system-wide Java (%s)", strerror(errno)); diff --git a/src/main/c/platform.c b/src/main/c/platform.c index e371348d..619ff173 100644 --- a/src/main/c/platform.c +++ b/src/main/c/platform.c @@ -33,7 +33,6 @@ #include "platform.h" #include "file-funcs.h" #include "java.h" -#include "splash.h" #include "xalloc.h" #include @@ -949,7 +948,6 @@ int launch_32bit_on_tiger(int argc, char **argv) strcpy(argv[0] + offset, match); return 0; } - hide_splash(); execv(argv[0], argv); fprintf(stderr, "Could not execute %s: %d(%s)\n", argv[0], errno, strerror(errno)); diff --git a/src/main/c/splash.c b/src/main/c/splash.c deleted file mode 100644 index b79633db..00000000 --- a/src/main/c/splash.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * #%L - * ImageJ software for multidimensional image processing and analysis. - * %% - * Copyright (C) 2007 - 2016 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ -#include "common.h" -#include "splash.h" -#include "file-funcs.h" -#include "java.h" -#include "platform.h" -#include "string-funcs.h" - -/* Splash screen */ - -static int no_splash; -static void (*SplashClose)(void); - -void disable_splash(void) -{ - no_splash = 1; -} - -struct string *get_splashscreen_lib_path(const char *jre_home) -{ -#if defined(__APPLE__) - struct string *search_root = string_initf("/System/Library/Java/JavaVirtualMachines"); - struct string *result = string_init(32); - if (!find_file(search_root, 4, "libsplashscreen.jnilib", result)) { - string_release(result); - result = NULL; - } - string_release(search_root); - return result; -#endif - if (!jre_home) - return NULL; -#if defined(WIN32) - return string_initf("%s/bin/splashscreen.dll", jre_home); -#elif defined(__linux__) - return string_initf("%s/lib/%slibsplashscreen.so", jre_home, sizeof(void *) == 8 ? (guess_java_version() >= 0x09000000 ? "" : "amd64/") : "i386/"); -#else - return NULL; -#endif -} - -void show_splash(const char *file_jar_name) -{ - const char *image_path = NULL; - struct string *lib_path = get_splashscreen_lib_path(get_jre_home()); - void *splashscreen; - int (*SplashInit)(void); - int (*SplashLoadFile)(const char *path); - int (*SplashSetFileJarName)(const char *file_path, const char *jar_path); - - if (no_splash || !lib_path || SplashClose) - return; - - if (FLAT_SPLASH_PATH) - image_path = ij_path(FLAT_SPLASH_PATH); - if (!image_path || !file_exists(image_path)) - image_path = ij_path(SPLASH_PATH); - if (!image_path || !file_exists(image_path)) - return; - - splashscreen = dlopen(lib_path->buffer, RTLD_LAZY); - if (!splashscreen) { - if (debug) - error("Splashscreen library not found: '%s'", lib_path->buffer); - string_release(lib_path); - return; - } - SplashInit = dlsym(splashscreen, "SplashInit"); - SplashLoadFile = dlsym(splashscreen, "SplashLoadFile"); - SplashSetFileJarName = dlsym(splashscreen, "SplashSetFileJarName"); - SplashClose = dlsym(splashscreen, "SplashClose"); - if (!SplashInit || !SplashLoadFile || !SplashSetFileJarName || !SplashClose) { - if (debug) - error("Ignoring splashscreen:\ninit: %p\nload: %p\nsetFileJar: %p\nclose: %p", SplashInit, SplashLoadFile, SplashSetFileJarName, SplashClose); - string_release(lib_path); - SplashClose = NULL; - return; - } - - SplashInit(); - SplashLoadFile(image_path); - SplashSetFileJarName(image_path, file_jar_name); - - string_release(lib_path); -} - -void hide_splash(void) -{ - if (!SplashClose) - return; - SplashClose(); - SplashClose = NULL; -} - - diff --git a/src/main/include/splash.h b/src/main/include/splash.h deleted file mode 100644 index d36f0d0b..00000000 --- a/src/main/include/splash.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * #%L - * ImageJ software for multidimensional image processing and analysis. - * %% - * Copyright (C) 2007 - 2016 Board of Regents of the University of - * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck - * Institute of Molecular Cell Biology and Genetics. - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ -#ifndef SPLASH_H -#define SPLASH_H - -#define SPLASH_PATH "images/icon.png" -/* So far, only Windows and MacOSX support splash with alpha, Linux does not */ -#if defined(WIN32) || defined(__APPLE__) -#define FLAT_SPLASH_PATH NULL -#else -#define FLAT_SPLASH_PATH "images/icon-flat.png" -#endif - -extern void disable_splash(void); -extern struct string *get_splashscreen_lib_path(const char *jre_home); -/* file_jar_name refers to the file which -- when loaded -- will trigger the splash to be hidden */ -extern void show_splash(const char *file_jar_name); -extern void hide_splash(void); - -#endif diff --git a/src/main/java/net/imagej/launcher/ClassLauncher.java b/src/main/java/net/imagej/launcher/ClassLauncher.java index f4032179..3fabd10e 100644 --- a/src/main/java/net/imagej/launcher/ClassLauncher.java +++ b/src/main/java/net/imagej/launcher/ClassLauncher.java @@ -74,6 +74,9 @@ public class ClassLauncher { */ public static void main(final String[] arguments) { originalArguments = arguments; + if (Boolean.getBoolean("imagej.splash") || System.getProperty("imagej.splash") == null) { + SplashScreen.show(); + } run(arguments); } diff --git a/src/main/java/net/imagej/launcher/SplashScreen.java b/src/main/java/net/imagej/launcher/SplashScreen.java new file mode 100644 index 00000000..74f02ee0 --- /dev/null +++ b/src/main/java/net/imagej/launcher/SplashScreen.java @@ -0,0 +1,124 @@ +/* + * #%L + * ImageJ software for multidimensional image processing and analysis. + * %% + * Copyright (C) 2007 - 2018 ImageJ developers. + * %% + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * #L% + */ + +package net.imagej.launcher; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Window; +import java.io.File; + +import javax.swing.ImageIcon; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.JWindow; + +/** + * Application splash screen. + * + * @author Curtis Rueden + */ +public class SplashScreen { + + private static final int PROGRESS_MAX = 10000; + + private static final String LOGO_PATH = "images/logo.png"; + + private static Object splashWindow; + private static Object progressBar; + + public static void show() { + if (Boolean.getBoolean("java.awt.headless")) return; + final JWindow window = new JWindow(); + splashWindow = window; // Save a non-AWT reference to the window. + final File logoFile = new File(new File(System.getProperty("imagej.dir")), LOGO_PATH); + final JLabel logoImage = new JLabel(new ImageIcon(logoFile.getPath())); + final JProgressBar bar = new JProgressBar(); + bar.setMaximum(PROGRESS_MAX); + progressBar = bar; // Save a non-AWT reference to the progress bar. + bar.setStringPainted(true); + bar.setString("Starting ImageJ..."); + + // lay out components + final JPanel pane = new JPanel(); + pane.setOpaque(false); + pane.setLayout(new BorderLayout()); + pane.add(logoImage, BorderLayout.CENTER); + pane.add(bar, BorderLayout.SOUTH); + window.setContentPane(pane); + window.pack(); + + window.setAlwaysOnTop(true); + window.setLocationRelativeTo(null); + window.setBackground(new Color(0, 0, 0, 0)); + + window.setVisible(true); + + // Watch for other windows; kill the splash screen when one shows up. + new Thread((Runnable) () -> { + while (true) { + try { + Thread.sleep(100); + } + catch (final InterruptedException exc) {} + if (splashWindow == null) return; + final Window[] windows = Window.getWindows(); + for (final Window win : windows) { + if (win.isVisible() && win != splashWindow) { + hide(); + return; + } + } + } + }, "Splash-Monitor").start(); + } + + public static void update(final String message, final double progress) { + if (progressBar == null) return; + ((JProgressBar) progressBar).setString(message); + ((JProgressBar) progressBar).setValue((int) (progress * PROGRESS_MAX)); + } + + public static void hide() { + if (splashWindow == null) return; + ((Window) splashWindow).dispose(); + splashWindow = null; + } + + public static void main(final String[] args) throws Exception { + SplashScreen.show(); + int steps = 40; + for (int i=1; i<=steps; i++) { + SplashScreen.update(i + "/" + steps, (double) i / steps); + Thread.sleep(100); + } + SplashScreen.hide(); + } +} From 2c871854d909f8d47f029c716aee9e792bb62b2b Mon Sep 17 00:00:00 2001 From: Stefan Helfrich Date: Tue, 10 Apr 2018 08:07:59 +0200 Subject: [PATCH 2/6] Remove lambda expression --- pom.xml | 2 +- .../net/imagej/launcher/SplashScreen.java | 28 +++++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index eaa5d769..098079a5 100644 --- a/pom.xml +++ b/pom.xml @@ -129,7 +129,7 @@ Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. ImageJ software for multidimensional image processing and analysis. - 1.8 + 1.6 diff --git a/src/main/java/net/imagej/launcher/SplashScreen.java b/src/main/java/net/imagej/launcher/SplashScreen.java index 74f02ee0..3786f9b7 100644 --- a/src/main/java/net/imagej/launcher/SplashScreen.java +++ b/src/main/java/net/imagej/launcher/SplashScreen.java @@ -82,18 +82,22 @@ public static void show() { window.setVisible(true); // Watch for other windows; kill the splash screen when one shows up. - new Thread((Runnable) () -> { - while (true) { - try { - Thread.sleep(100); - } - catch (final InterruptedException exc) {} - if (splashWindow == null) return; - final Window[] windows = Window.getWindows(); - for (final Window win : windows) { - if (win.isVisible() && win != splashWindow) { - hide(); - return; + new Thread(new Runnable() { + + @Override + public void run() { + while (true) { + try { + Thread.sleep(100); + } + catch (final InterruptedException exc) {} + if (splashWindow == null) return; + final Window[] windows = Window.getWindows(); + for (final Window win : windows) { + if (win.isVisible() && win != splashWindow) { + hide(); + return; + } } } } From 997f70db61f422f977aa94ed310ded9eef72e419 Mon Sep 17 00:00:00 2001 From: Stefan Helfrich Date: Tue, 10 Apr 2018 08:09:08 +0200 Subject: [PATCH 3/6] Remove main() --- src/main/java/net/imagej/launcher/SplashScreen.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/main/java/net/imagej/launcher/SplashScreen.java b/src/main/java/net/imagej/launcher/SplashScreen.java index 3786f9b7..9ff30738 100644 --- a/src/main/java/net/imagej/launcher/SplashScreen.java +++ b/src/main/java/net/imagej/launcher/SplashScreen.java @@ -115,14 +115,4 @@ public static void hide() { ((Window) splashWindow).dispose(); splashWindow = null; } - - public static void main(final String[] args) throws Exception { - SplashScreen.show(); - int steps = 40; - for (int i=1; i<=steps; i++) { - SplashScreen.update(i + "/" + steps, (double) i / steps); - Thread.sleep(100); - } - SplashScreen.hide(); - } } From 982f1dd8d136d20a94fb94a2d4a428907d65466a Mon Sep 17 00:00:00 2001 From: Stefan Helfrich Date: Tue, 10 Apr 2018 08:10:17 +0200 Subject: [PATCH 4/6] Fetch exceptions from SplashScreen.show() Issues with the splash should never stop ImageJ from starting. --- src/main/java/net/imagej/launcher/ClassLauncher.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/imagej/launcher/ClassLauncher.java b/src/main/java/net/imagej/launcher/ClassLauncher.java index 3fabd10e..4b210d1a 100644 --- a/src/main/java/net/imagej/launcher/ClassLauncher.java +++ b/src/main/java/net/imagej/launcher/ClassLauncher.java @@ -75,7 +75,12 @@ public class ClassLauncher { public static void main(final String[] arguments) { originalArguments = arguments; if (Boolean.getBoolean("imagej.splash") || System.getProperty("imagej.splash") == null) { - SplashScreen.show(); + try { + SplashScreen.show(); + } + catch (Throwable t) { + t.printStackTrace(); + } } run(arguments); } From 5f5603cfda4e90a34e59392129a4416bce53d855 Mon Sep 17 00:00:00 2001 From: Stefan Helfrich Date: Tue, 10 Apr 2018 08:20:04 +0200 Subject: [PATCH 5/6] Add fallback if -Dimagej.dir is not set --- src/main/java/net/imagej/launcher/SplashScreen.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/imagej/launcher/SplashScreen.java b/src/main/java/net/imagej/launcher/SplashScreen.java index 9ff30738..52f13234 100644 --- a/src/main/java/net/imagej/launcher/SplashScreen.java +++ b/src/main/java/net/imagej/launcher/SplashScreen.java @@ -58,7 +58,9 @@ public static void show() { if (Boolean.getBoolean("java.awt.headless")) return; final JWindow window = new JWindow(); splashWindow = window; // Save a non-AWT reference to the window. - final File logoFile = new File(new File(System.getProperty("imagej.dir")), LOGO_PATH); + final String parent = System.getProperty("imagej.dir") != null ? System + .getProperty("imagej.dir") : "."; + final File logoFile = new File(parent, LOGO_PATH); final JLabel logoImage = new JLabel(new ImageIcon(logoFile.getPath())); final JProgressBar bar = new JProgressBar(); bar.setMaximum(PROGRESS_MAX); From fb1f044611471353b240a235d00090317364fb52 Mon Sep 17 00:00:00 2001 From: Stefan Helfrich Date: Tue, 10 Apr 2018 09:08:51 +0200 Subject: [PATCH 6/6] Don't splash if -Dimagej.splash is not set --- src/main/c/ImageJ.c | 2 +- src/main/java/net/imagej/launcher/ClassLauncher.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/c/ImageJ.c b/src/main/c/ImageJ.c index 39a1fb3a..7d9d61b8 100644 --- a/src/main/c/ImageJ.c +++ b/src/main/c/ImageJ.c @@ -1770,7 +1770,7 @@ static void parse_command_line(void) maybe_reexec_with_correct_lib_path(java_library_path); - if (splash && !options.dry_run && !options.use_system_jvm && !headless && (is_default_ij1_class(main_class) || !strcmp(default_main_class, main_class))) + if (splash && !headless && (is_default_ij1_class(main_class) || !strcmp(default_main_class, main_class))) add_option(&options, "-Dimagej.splash=true", 0); /* set up class path */ diff --git a/src/main/java/net/imagej/launcher/ClassLauncher.java b/src/main/java/net/imagej/launcher/ClassLauncher.java index 4b210d1a..e4ce9586 100644 --- a/src/main/java/net/imagej/launcher/ClassLauncher.java +++ b/src/main/java/net/imagej/launcher/ClassLauncher.java @@ -74,7 +74,11 @@ public class ClassLauncher { */ public static void main(final String[] arguments) { originalArguments = arguments; - if (Boolean.getBoolean("imagej.splash") || System.getProperty("imagej.splash") == null) { + // If the imagej.splash system property is not set, the splash screen is not + // shown. The --dry-run option of the launcher will set this property to + // true by default. Starting the launcher with --no-splash does not set the + // property. + if (Boolean.getBoolean("imagej.splash")) { try { SplashScreen.show(); }