Previous

Platform-Specific Details: Running a Swing Application

To run a Swing application, you must use a class path that includes not only swing.jar, classes.zip, and the source code directory (usually "."), but also the .jar files for any looks and feels that the application uses.

Except for the JavaTM Look and Feel (formerly known as "Metal"), each look and feel has its own .jar file -- for example, windows.jar. The Java Look and Feel is included in the swing.jar archive.

Solaris
If you've set the JAVA_HOME and SWING_HOME environment variables, and if the application uses the Motif look and feel:
$JAVA_HOME/bin/java -classpath .:$SWING_HOME/swing.jar:$JAVA_HOME/lib/classes.zip:$SWING_HOME/motif.jar SomeClass
Which might result in something like this:
/home/me/jdk1.1.7/bin/java -classpath .:/home/me/swing-1.1beta3/swing.jar:/home/me/jdk1.1.7/lib/classes.zip:/home/me/swing-1.1beta3/motif.jar SomeClass

DOS shell (Windows 95/NT)
If you've set the JAVA_HOME and SWING_HOME environment variables, and if the application uses the Windows look and feel:
[PENDING: check the following]
%JAVA_HOME%\bin\java -classpath .;%SWING_HOME%\swing.jar;%JAVA_HOME%\lib\classes.zip;%SWING_HOME%\windows.jar SomeClass
Which might result in something like this:
C:\java\jdk1.1.7\bin\java -classpath .;C:\java\swing-1.1beta3\swing.jar;C:\java\jdk1.1.7\lib\classes.zip;C:\java\swing-1.1beta3\windows.jar SomeClass


Previous