I'm a Java beginner trying to follow the chapter order of Bruce Eckel's Thinking in Java, 3rd edition. I downloaded the source code of his "toy examples" and I'm looking forward to solve the exercises, tweak the code and write my own stuff, compiling in the command line with javac. I installed the JDK 6 and ant, compiled the book source code, but still I can't import the package com.bruceeckel.simpletest. When I try to compile code which imports it, it says the package doesn't exist.
I'm using Windows XP, and the user variable PATH is set as:
Sounds like a problem with the CLASSPATH. don't set a system CLASSPATH. Instead add the location of the Bruce Eckel files. We have an FAQ, and there are details of the -cp tag "java" tool and the "javac" tool in those links. Try something like this when you open a new command lineRemember the .
Other people will probably give better advice how to do it.
Or you can specify it when you compile and run the code, using the -cp or -classpath option, for example:
javac -cp .;C\MyFiles\BruceEckel MyProgram.java
java -cp .;C\MyFiles\BruceEckel MyProgram
You could put this in a batch file (a file with the *.bat extension) that you can run from the command prompt if you don't want to type the whole command every time.