428
|
Chapter 11, Native Integration and Packaging
#85 Stuff Stuff in JARs
HACK
To actually start this whole class, you simply call the launch method like
this:
public static void main(String[] args) {
new SingleLauncherApplication( ).launch(args);
}
The first time the program is launched it will create the window with the
label. For example, running the following command would result in
Figure 11-8.
java -cp . SingleLauncherApplication 'anonymous'
Now, start the program again, with the first running:
java -cp . SingleLauncherApplication 'perspicacity'
Instead of creating a new window, the program will contact the original (and
still running) instance and change the text to Figure 11-9.
H A C K
#85
Stuff Stuff in JARs Hack #85
Hide images, sounds, and more inside JAR files.
Does your application need a special installer? Do you have to put images,
sounds, icons, and properties all in their own folders or other special loca-
tions relative to your application? Does your application launch with a .sh
script on Unix or a .bat on Windows?
You do? Really? I was just speaking rhetorically. I kind of figured everyone
was using JARs by now.
Figure 11-8. Initial launch
Figure 11-9. After relaunching

Get Swing Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.