Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Online Training

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
Print Button
 

Setting the CLASSPATH Environment Variable
on the Windows Platform

To develop and test applications written in the Java TM programming language using the Windows environment, you must set a path and CLASSPATH so programs can locate necessary classes and .jar files.

Open the autoexec.bat file (located in your root (\) directory) in a text editor, or type sysedit in Run from the Start button.

If you're only going to be using the J2SE, then the following line is all that's needed:

PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\JDK\BIN;

The example above assumes C is the drive where the development kit has been installed and that the directory name is JDK.

If you may be using other development tools in addition to J2SE, then follow the instuctrions below. Also note how other tools, such as the JavaTM Servlet Web Development Kit and the MySQL database driver can be included in the CLASSPATH. These may or may not apply to your needs.

Enter the following to set a CLASSPATH:

SET PATH=%PATH%;%JAVAHOME%\BIN

PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\JDK\BIN;

SET CLASSPATH=.;C:\jdk\lib\tools.jar;
C:\jswdk\lib\servlet.jar;
C:\mm.mysql.jdbc-1.2b;%CLASSPATH%

Note: To ensure programs locate the complier and APIs, keep the SET CLASSPATH command on one line.

Save the file and close the editor. To force these settings to take place, simply restart your computer, or open an MS-DOS window and type autoexec.bat.

New-to-Java Programming Center
Learning Materials
Learning Paths
For Web Masters
Discussion Forums
Interesting Web Sites
Software Downloads


Print Button
[ This page was updated: 31-Mar-2000 ]
Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary - Applets - Tutorial - Employment - Business & Licensing - Java Store - Java in the Real World
FAQ | Feedback | Map | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-2000 Sun Microsystems, Inc.
All Rights Reserved. Terms of Use. Privacy Policy.