This is a rather basic question related to packages but somehow I tend to forget how it is done.
I have the following hierarchy on my Win2K desktop.
D:/Documents and Settings/Administrator/Desktop/JavaTrial
D:/Documents and Settings/Administrator/Desktop/JavaTrial/package1
The sub-folder package1 has a file named PClass.java which is as follows:
package package1;
import java.io.*;
The folder JavaTrial has a single
java file named MyMainClass.java which is as follows :
So I am trying to call a class within package1 from outside it.
However, when I compile the files, PClass.java compiles without errors while compiling MyMainClass.java gives the following errors:
---------- Compile Java File ----------
MyMainClass.java:2: package package1 does not exist
import package1.*;
^
MyMainClass.java:13: package package1 does not exist
package1.PClass obj = new package1.PClass();
^
MyMainClass.java:13: package package1 does not exist
package1.PClass obj = new package1.PClass();
^
3 errors
It says package1 does not exist. Why ? Whats wrong ?
Please help.
Thanks