i write 2 two java application (in separate file) one is called SubclassB.java and another one is SuperclassA.java -----------------------------------------------
when i compile the SuperclassA.java, no problem. But when i compile SubclassB.java this errors come up: C:\My Documents\Java\SubclassB.java:3: package packageA does not exist import packageA.*; ^ C:\My Documents\Java\SubclassB.java:5: cannot resolve symbol symbol : class SuperclassA location: class packageB.SubclassB public class SubclassB extends SuperclassA ^ C:\My Documents\Java\SubclassB.java:16: cannot resolve symbol symbol : class SuperclassA location: class packageB.AnyClassB SuperclassA obj = new SuperclassA( ); ^ C:\My Documents\Java\SubclassB.java:9: cannot resolve symbol symbol : method superclassMethodA () location: class packageB.SubclassB superclassMethodA(); ^ C:\My Documents\Java\SubclassB.java:16: cannot resolve symbol symbol : class SuperclassA location: class packageB.AnyClassB SuperclassA obj = new SuperclassA( ); ^ 5 errors Tool completed with exit code 1 do i have to set my -classpath or what ? pls tell me...i'm new in java. [ February 12, 2002: Message edited by: Cindy Glass ]
if the packageA is in folder say "thecode" and your making packageB in that folder,you got to import thecode.packageA.*; ie. always go up one level if your in another package within abig package(folder) hope i'm right
Aymen Esawey<br />SCJP <img src="smile.gif" border="0"> <br /><a href="http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=32&t=001968" target="_blank" rel="nofollow">how to nuke the SUN </a>
Make sure that your directory C:\My Documents\Java is in the classpath. Then, when you say that SuperclassA is in package packageA, you have to make sure that it IS. You are promising the compiler that there is a subdirectory under the classpath with the given package name. So SuperclassA.class needs to reside in C:\My Documents\Java\packageA\SuperclassA.class - unless of course you have it jarred up, in which case the jar file that contains that subdirectory needs to be in the classpath directory.