O'Reilly logo

Swing Hacks by Chris Adamson, Joshua Marinacci

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required