Hello,
can someone help me with this package question please:
i have the following directory structure: C:\pack1\pack2\
inside pack2 i have the following source files:
Class1.java:
package pack1.pack2;
public interface Class1
{}
Class2.java:
package pack1.pack2;
public class Class2 implements Class1
{}
i can compile Class1.java using 'c:\pack1\pack2\javac Class1.java' with no problems.
afther that if i try and compile Class2.java using 'c:\pack1\pack2\javac Class2.java'
i get an error that the symbol Class1 cannot be resolved.
why is that? arent they in the same package? why cant't the class be found?
I know this has to do with classpath and packages but am not sure how.
I found a solution that is the following: 'c:\pack1\pack2\javac -classpath c:\ Class2.java'
which works without problems. so setting the classpath that way solves it. But shouldnt'
it work without needing to do that.
If i remove the package statements at both files all compile with no problems.
I never used package statements! and its quite frustrating now.
Can someone please explain to me why the first attempt fails, the second works.
or point me to an explanation on the net. The
java tutorial doesnt address this directly,
it only mentions how to import packages and stuff!
Any help with this?
sorry but is this more appropriate in the intermediate forum? thanks.
[ September 12, 2003: Message edited by: Melanie Parker ]