To run a Swing application, you must use a class path that includes not onlyswing.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 theswing.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:
Which might result in something like this:$JAVA_HOME/bin/java -classpath .:$SWING_HOME/swing.jar:$JAVA_HOME/lib/classes.zip:$SWING_HOME/motif.jar SomeClass/home/me/jdk1.1.6/bin/java -classpath .:/home/me/swing-1.1beta/swing.jar:/home/me/jdk1.1.6/lib/classes.zip:/home/me/swing-1.1beta/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:
Which might result in something like this:[PENDING: check the following] %JAVA_HOME%\bin\java -classpath .;%SWING_HOME%\swing.jar;%JAVA_HOME%\lib\classes.zip;%SWING_HOME%\windows.jar SomeClassC:\java\jdk1.1.6\bin\java -classpath .;C:\java\swing-1.1beta\swing.jar;C:\java\jdk1.1.6\lib\classes.zip;C:\java\swing-1.1beta\windows.jar SomeClass