When compiling a Swing program, you must use a class path that includes theswing.jar
file. If you use the-classpath
option (as the following examples do), you must also specify the appropriate JDKclasses.zip
file and the directory under which the source code lives (usually ".").
- Solaris
- If you've set the JAVA_HOME and SWING_HOME environment variables:
Which might result in something like this:$JAVA_HOME/bin/javac -classpath .:$SWING_HOME/swing.jar:$JAVA_HOME/lib/classes.zip SomeClass.java/home/me/jdk1.1.6/bin/javac -classpath .:/home/me/swing-1.1beta/swing.jar:/home/me/jdk1.1.6/lib/classes.zip SomeClass.java
- DOS shell (Windows 95/NT)
- If you've set the JAVA_HOME and SWING_HOME environment variables:
Which might result in something like this:[PENDING: put env variable version of following command here] %JAVA_HOME%\bin\javac -deprecation -classpath .;%SWING_HOME%\swing.jar;%JAVA_HOME%\lib\classes.zip SomeClass.javaC:\java\jdk1.1.6\bin\javac -deprecation -classpath .;C:\java\swing-1.1beta\swing.jar;C:\java\jdk1.1.6\lib\classes.zip SomeClass.java