OK, after doing some major brainstorming, researching, reading and
testing, I'd like to get a confirmation on whether I'm using all of the things in the Subject line correctly (I'm running Windows 2000, BTW):
2 source files:
//First src file saved as Test.java
package testPackage;
public class Test {...}
//Second src file saved as TestingTest.java
import testPackage.*;
public class TestingTest extends Test {...}
Directory structure: C:\Java\Sources for, well, *.java sources. C:\Java\Objects for *.class files.
The compiling is done from the C:\Java\Sources directory by issuing javac -d C:\Java\Objects *.java, which creates TestingTest.class in the CLASSPATH directory, then testPackage directory in the CLASSPATH directory, and lastly the Test.class in the newly created directory.
To call the TestingTest I issue
java TestingTest from anywhere (that's where CLASSPATH comes in handy I guess), and to call Test I issue java testPackage.Test.
Ok, all is working fine, however, here are some things that I'm still not quite clear about:
Somehow I believed that one needs to specify just the root directory (in my case C:\Java) in the CLASSPATH. However, it doesn't seem to work, but adding \Objects\ fixes it... Another understanding (however possibly wrong) was that javac -d and CLASSPATH were related, i.e. I wouldn't need to specify the whole path, just the last directory for compiling. So instead of the example above the setup should have been C:\Java for CLASSPATH, then issue javac -d \Objects\ *.java to compile from the sources directory. That doesn't work as well. So what is the correct setup then and is there a relationship between CLASSPATH variable and javac -d?
Thanx for any clarification,
Sergey