aspose file tools*
The moose likes Beginning Java and the fly likes Regarding package usage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Regarding package usage" Watch "Regarding package usage" New topic
Author

Regarding package usage

Shaan patil
Ranch Hand

Joined: Dec 22, 2007
Posts: 58
Hi all ,

I have five java files like this

1. Three files(A.java,B.java,C.java) which are of same package p1(These are in folder c:\p1)

2. Two files(D.java,E.java) of package p2 type(These are in folder c:\p2 )

The class in D.java extends p1 package class A class in A.java file(as p1.A)

But I am unable to run the code as it gives a compile error ?
Compile error :It is saying canot find A class package

CLASSPATH is set as to point to c:\


What is the issue ?


"You cannot change the truth but truth can change you "
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Shaan patil:
...The class in D.java extends p1 package class A class in A.java file(as p1.A)...

Are you sure you're extending D "as p1.A" (that is, class D extends p1.A)? Or are you just extending A (that is, class D extends A)?

If you are not providing the qualified name (p1.A) and you don't have an import statement (import p1.*; or import p1.A;), then you will get the error "cannot find symbol" for class A.
[ January 04, 2008: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Shaan patil
Ranch Hand

Joined: Dec 22, 2007
Posts: 58
Hi ,

Ya I am sure I have extended the full qualified name and used import statements also .

But still the issue reamins ?

Regards
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

It works for me.

c:\p1\A.java...

c:\p2\D.java...

Command prompt...
>javac -cp c:\ c:\p2\D.java

How are you specifying your classpath? Is it in the command line? Or have you set a system variable? If you set a system variable, try it in the command line (as I did above), and this will tell you if something is wrong with your system variable.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding package usage