Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace native splash with Java implementation #53

Merged
merged 6 commits into from
Oct 2, 2018
Merged

Conversation

stelfrich
Copy link
Member

@stelfrich stelfrich commented Apr 9, 2018

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.

Thanks for working on this @ctrueden!

This closes #50 and closes #40.

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.
Copy link
Member

@ctrueden ctrueden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for finalizing this, @stelfrich! Requested some minor changes.

Did you do much testing of non-headless CLI scenarios, to ensure they still don't splash?

pom.xml Outdated
@@ -129,7 +129,7 @@ Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck
Institute of Molecular Cell Biology and Genetics.</license.copyrightOwners>
<license.projectName>ImageJ software for multidimensional image processing and analysis.</license.projectName>

<scijava.jvm.version>1.6</scijava.jvm.version>
<scijava.jvm.version>1.8</scijava.jvm.version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? (If we do need this: we can just remove this line, rather than changing it, since 1.8 is the default these days.)
Edit: Oh, it was for the lambda below. I think we should change the code not to use a lambda, and instead be 1.6-compliant. Sorry about that, but it would keep the door open for a smarter launcher that complains when the version of Java is too old, rather than simply exploding.

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we be a bit smarter about the path here? If imagej.dir is not set, would be nice to fall back to new File(".") or some such.

splashWindow = null;
}

public static void main(final String[] args) throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This main method was just for testing. Could you please remove it?

@@ -74,6 +74,9 @@
*/
public static void main(final String[] arguments) {
originalArguments = arguments;
if (Boolean.getBoolean("imagej.splash") || System.getProperty("imagej.splash") == null) {
SplashScreen.show();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be paranoid, but we may want to wrap the SplashScreen.show() with a try { ... } catch (Throwable t) { t.printStackTrace(); } because we really don't want any bugs in the splash screen to prevent ImageJ from starting up.

@stelfrich
Copy link
Member Author

Thanks for your feedback @ctrueden!

Did you do much testing of non-headless CLI scenarios, to ensure they still don't splash?

I thought I had and then went back to do some more testing only to find out that there was an issue with the --no-splash option. The behavior is now that -Dimagej.splash=true has to be set in order for the splash screen to show up. If it's set to false or is not set at all, the splash screen will not be shown. Also, the --headless option overrides the setting on the launcher level, plus we have an additional check in place.

I have tested

  • ./ImageJ-linux64 → splash
  • ./ImageJ-linux64 --no-splash → no splash
  • ./ImageJ-linux64 --system --no-splash → no splash
  • ./ImageJ-linux64 --headless → no-splash
  • ./ImageJ-macosx → splash
  • ./ImageJ-macosx --no-splash → no splash
  • ./ImageJ-macosx --system --no-splash → no splash
  • ./ImageJ-macosx --headless → no-splash
  • via SSH (no xvfb): - ./ImageJ-linux64 → no splash

If you are fine with the changes, I'll squash them into one commit (they don't seem educational) and merge to master.

@ctrueden
Copy link
Member

What about the ./ImageJ-macosx --update command line tool?

@stelfrich
Copy link
Member Author

stelfrich commented Apr 25, 2018

  • ./ImageJ-macos --update → no splash, but expected output
  • ./ImageJ-macos --bsh → no splash, but interactive shell
  • ./ImageJ-macos --javadoc → no splash, but expected error
  • ./ImageJ-macos --javap → no splash, but expected error
  • What would we expect for ./ImageJ-macos --ij1, @ctrueden? Currently, the new splash screen is shown instead of the old one.

@ctrueden
Copy link
Member

ctrueden commented Oct 2, 2018

@stelfrich Sorry for dropping the ball on this. Any reasons not to merge this? The worst-case scenario would be that people's ImageJs don't launch anymore... but I think there is little danger of that here, no? If the launcher "over-splashes" (i.e. splashes in scenarios where it shouldn't), we can simply push out additional fixes. Right?

@stelfrich
Copy link
Member Author

If the launcher "over-splashes" (i.e. splashes in scenarios where it shouldn't), we can simply push out additional fixes. Right?

Correct. Let's get this merged!

@ctrueden ctrueden merged commit 271fb19 into master Oct 2, 2018
@ctrueden ctrueden deleted the splash-stelfrich branch October 2, 2018 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Splash screen broken with Java 9 The splash screen is broken on OS X
2 participants