Matt Gerrans
Posts: 1153
Nickname: matt
Registered: Feb, 2002
|
|
Re: Extend from another directory
|
Posted: Oct 30, 2003 3:34 PM
|
|
That's only if the other class is in the package folder1 and if the root of folder1 (in this case C:\ ) is in the classpath. If the first class is not in any package, you just need to add folder1 itself to the classpath so that it can be found. (In Windows, set classpath=%classpath%;C:\folder1 will do it). Alternatively, (after compiling the base class from its directory) you could compile the derived class from its own directory like this:
c:\folder2> javac -classpath ..\folder1 Sub.java This way you are telling it where to find the super class. (If you run javac without any parameters, you can see what options is has).
If you don't understand all this classpath stuff, then search this forum and you'll find some explanations.
|
|