I am reading Bruce Eckel's book "Thinking in Java, 3rd edition" and trying to compile one of the examples. Bruce provided unit test classes in a directory structure:
com/bruceeckel/simpletest
Where do I copy this directory structure so that it's available to all source code when compiling, much like all core Java classes.
Executing following command:
javac example.java
produces an error about missing test classes from above mentioned directory structure.
If your class files are at: <xxx>/com/bruceeckel/simpletest/ dir. then set the classpath accordingly as below.
export CLASSPATH=<xxx> or use "setenv" depending on the OS on which you are running java programs.
Also export is a Linux/unix thing. Really what you want to do is add the base of com/bruceeckel/simpletest (or com\bruceeckel\simpletest) to your classpath environment variable for whatever OS you are running.
Thanks a lot for your help guys, Matt is correct; I made a mistake by setting CLASSPATH to a com directory instead a parent one. It compiles properly now.
Doesn't JAVA environment have something like Global Assembly Cache in .NET? I was thinking about dropping the whole directory structure into some directory in JRE directory and all JAVA programs would be able to use the classes without setting any environment variables.
Any jar files you put in the lib/ext directory of the JRE will automatically be searched. I forget whether you can plop unadorned class files there, as well, but that would probably be a bad idea, anyway.