File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Package Problem, Please Help... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Package Problem, Please Help..." Watch "Package Problem, Please Help..." New topic
Author

Package Problem, Please Help...

Marius BONG
Greenhorn

Joined: Dec 16, 2001
Posts: 13
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 ]
aymen esawey
Ranch Hand

Joined: Jan 29, 2002
Posts: 61
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>
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
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.
Marius BONG
Greenhorn

Joined: Dec 16, 2001
Posts: 13
Ok..i understand now..thanks a lot.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Package Problem, Please Help...