Using JDK splash screen from Web Start

Scott Kovatch scott.kovatch at oracle.com
Wed May 2 08:08:59 PDT 2012


On May 2, 2012, at 4:34 AM, Anthony Petrov wrote:

>>> Sigh… That breaks the contract of the splash methods. Looking at SplashPlatformInit, I see two things. One, it assumes that it isn't being called on the main thread, because it attempts to call [NSApplicationAWT sharedApplication] in a main queue dispatch. Two, it assumes that libawt is available.
>>> 
>>> For Web Start neither of these are true. We spawn a process for the splash screen with 'javaws -splash <port> <filename>', which eventually just calls SplashInit, SplashLoadFile and SplashClose when it gets a signal to quit. All of this happens on the main thread. Now I'll have to imitate java_md and spawn a thread that calls all of this stuff. And link against AWT!
> 
> Splash screen doesn't require to link against AWT. All the code needed to start up a NSApp instance for the splash screen has been extracted to the libosxapp dynamic library - that's what the splash screen needs to be linked against.

That's good to know. I didn't do an 'nm' on libosxapp; it didn't occur to me that it would be in there.

> And yes, I think you have to do something similar to what we do in java_md.

Okay. I'm not a fan of replicating code like that, but if I have to, I have to.

> We decided to drop this idea because it would involve inter-process communication between the _spalsh and java processes because a java app may want to manipulate the splash screen. I'm not saying that this is impossible to implement, but it looks like too much of an effort for such a toy feature as the splash screen. Besides, I don't see why would such an approach be preferable to what we have already implemented, why would we have to re-implement it. Are there any issues with the current implementation?

In general, no. I had no problems with using the splash feature in a simple AWT app. It's just that I won't be able to reuse as much code as I thought to implement a small feature, and that leaves me grouchy. :-)

Web Start, in fact, does exactly the kind of cross-process communication you describe to hide the splash screen after a short delay. 

-- Scott



More information about the macosx-port-dev mailing list