Setting the PATH variable tells your system where to find the Java executables, and this allows you to compile and run from any directory.
To set the PATH variable, see
Sun's installation instructions for Windows. Step 4 describes setting the PATH variable for Windows 2000 and XP. Hopefully, the Vista procedure isn't too different from XP.
Once your PATH is set, let's say you've created your own directory that's
not under the JDK's bin...
g:\java\examples\MyPack
And suppose this is where you've saved the above file as "AccountBalance.java." Now let's say the current directory is g:\java\examples. To compile, use the javac command along with the source file location (including the directory MyPack). Then to run, use the java command along with the
fully qualified class name (MyPack.AccountBalance).
G:\java\examples>
javac MyPack\AccountBalance.java G:\java\examples>
java MyPack.AccountBalance Note
JLS 6.7...
The fully qualified name of a top level class or top level interface that is declared in a named package consists of the fully qualified name of the package, followed by ".", followed by the simple name of the class or interface.
[ July 20, 2007: Message edited by: marc weber ]