CIS 35A: Introduction to Java Programming

Home | Green Sheet | Lectures | Assignments | FAQ

JDK and IDE

JDK and IDE
Path

A typical Path command

path=C:\Windows;C:\Program Files\Java\jdk1.6.0\bin

The command path

  • The command path on a Windows system tells Windows where to look for the commands that it is told to execute.
  • When you use Java tools, you need to add the path for the jdk1.6.0\bin directory.

How to check the current path

Start a Command Prompt or DOS Prompt. Then, type the word path to display the current path statement.

A typical Classpath command

classpath=.;c:\java\classes;

The class path

When you compile or run a program, the class path tells the JDK where to find the .class files you create. By default, the class path is the current directory.

When and how to modify the class path

  • If your system doesn't have a Classpath command, try to set the path and create a CLASSPATH as shown below (depending on what Windows you use):
    1. Click on START (lower left)
    2. Under "Settings" click on "Control Panel"
    3. Switch to "classic view" (upper left) -- not "category view"
    4. Click on the "System" icon.
    5. Click on the "Advanced" tab.
    6. Click on the "Environment Variables" button (bottom).
    7. Highlight "PATH" (in the top window) and click the "edit" button.
    8. NOTE: UNDER NO CIRCUMSTANCES SHOULD YOU EDIT OR MODIFY ANY OF THE "SYSTEM VARIABLES" -- you could render your entire computer unusable!

    9. Edit the "PATH" so it begins C:\Program Files\Java\jdk1.6.0_17\bin; (note: if you install Java into a different directory, you may need to change the directory from that listed above)
    10. After you have finished editing the PATH, click "OK". You are done setting your PATH. Now you have to create a new variable, called your CLASSPATH.
    11. Click on the "NEW" button below the top window.
    12. Under 'variable name' type CLASSPATH
    13. Under 'variable value' type . (yes, type a single period).
    14. Click OK.
    15. EXIT the control panel.
    16. Restart your computer.
    17. Test your installation by opening up a DOS window and verifying that both the commands "java" and "javac" are recognized.
  • If your system has a Classpath command that doesn't include the current directory, add the current directory to the class path.
  • To check the current class path, start a Command Prompt or DOS Prompt, and type the word set. This displays a variety of settings including the current class path.
JDK and IDE | JDK | Directory | Path | API Documentation | DOS commands | TextPad | Eclipse | NetBeans