The compiler needs to be able to locate the base of your package structure through the CLASSPATH setting. So, the folder that holds the
pack folder, needs to be somehow included in the CLASSPATH.
Try the following. (I'm working from my K:\java\temp folder.)
1. Create the pack folder - K:\java\temp\pack
2. Inside the K:\java\temp\pack folder, create parent1.java
3. From the command line, cd to K:\java\temp\pack and compile.
K:\java\temp\pack> javac parent1.java
It should compile successfully.
4. Inside the K:\java\temp\pack folder, create child1.java
5. From the command line, cd to K:\java\temp (NOT K:\java\temp\pack) and compile.
K:\java\temp> javac pack\child1.java
It should compile successfully, if your CLASSPATH is configured to include the current working directory (specified with a simple . - period). If it doesn't compile, then fix your CLASSPATH accordingly. Feel free to ask about how to do so.
6. You can now run the child1 program from the command line.
K:\java\temp>
java pack.child1
And it should output the following.
Hello
Hello
Neelima Paramsetty
7. Any luck?
[ April 12, 2004: Message edited by: Dirk Schreckmann ]