PATH variable

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page        

Answer:

Not usually.

PATH variable

Usually you create a disk directory someplace convenient to hold the various source files for a new project. You would like to run the compiler while working in that directory. The Windows operating system uses an environment variable called PATH that is a list of all the disk directories where it should look to find programs. To see what is in your PATH variable, type PATH in your command prompt (DOS) window. (To start a command prompt window, click on Start, then click on Run. Enter "cmd" in the Open: text box, then click OK.)

The system types out PATH= followed by a list of disk directories separated with semicolons. Exactly what you see depends on your OS and what you have done with it. If you don't see

C:/Program Files/Java/jdk1.6.0_07/bin

(or similar) in your PATH you will have to edit your PATH variable. The above picture does not show the directory for Java in the PATH, so the Java compiler will not run from the default directory. The error message following javac shows this problem.

QUESTION 2:

Can the PATH variable be changed?