Start of Tutorial > Start of Trail > Start of Lesson | Search |
You can make sure your browser's class path includes the Swing release in one of two ways:
- Use a browser-specific option to set your browser's class path.
- Set the
CLASSPATH
environment variable (this works for browsers based on the Java programming language but might not work for others).The following instructions give examples of each approach. For more information on setting the class path, see Managing Source and Class Files.
Warning: Permanently setting theCLASSPATH
environment variable can lead to trouble, since it's easy to forget to update it when you use a different version of the JDK or Swing. Instead, try to specify the class path programmatically, such as with a-classpath
command-line option. Or specify it at a shell prompt, rather than saving it in a file.The directory paths used below assume that you have installed both the JDK and Swing releases under
/home/me
(for Solaris) or on drive C (for Windows). You should adjust the directory paths to reflect your installation.
- Solaris
- If you're using the JDK Applet Viewer, then instead of specifying the
CLASSPATH
environment variable, then you can use the-J
option of theappletviewer
command to specify options to the interpreter. For example:appletviewer -J-classpath -J.:/home/me/swing-1.1/swing.jar:/home/me/jdk1.1.7/lib/classes.zip:/home/me/swing-1.1/motif.jar http://java.sun.com/docs/books/tutorial/post1.0/uiswing/start/HelloSwingApplet.htmlIf you choose to set the
CLASSPATH
environment variable, use a command like the following:Then invoke your browser as usual.setenv CLASSPATH .:/home/me/swing-1.1/swing.jar:/home/me/swing-1.1/motif.jar
- Windows 95/NT
- Sorry, no examples yet. See the above text and Setting Environment Variables for help. [PENDING: fill this out.]
Start of Tutorial > Start of Trail > Start of Lesson | Search |