I created the first package inside the directory C:\test\eugene\scjp containing the following source code:
package com.test.eugene.scjp;
public class SuperClass
{
private String name;
public SuperClass(String name)
{
this.name = name;
}
protected String getName()
{
return name;
}
}
Then I created the second package inside the directory C:\test\raj\scjp containing the following source code:
package com.test.raj.scjp;
import com.test.eugene.scjp.SuperClass;
public class SubClass extends SuperClass
{
public SubClass(String name)
{
super(name);
}
public void printName()
{
System.out.println(getName());
}
}
The first package compiled with no error. To compile the second package I first set the classpath=".;C:\test\eugene" pointing to the first package. Then I compile the second package and I am getting the error:
C:\test\raj\scjp>javac SubClass.java
SubClass.java:3: package com.test.eugene.scjp does not exist
import com.test.eugene.scjp.SuperClass;
^
SubClass.java:5: cannot find symbol
symbol: class SuperClass
public class SubClass extends SuperClass
^
SubClass.java:14: cannot find symbol
symbol : method getName()
location: class com.test.raj.scjp.SubClass
System.out.println(getName());
^
3 errors
It appears that the first package I am trying to import into the second package is not possible. Did I miss something?. Your help is kindly appreciated.
Thank You.