• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Package Problem, Please Help...

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok..i understand now..thanks a lot.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic