File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Package Searching Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Package Searching" Watch "Package Searching" New topic

Package Searching

Denise Advincula
Ranch Hand

Joined: Jan 01, 2007
Posts: 163
Hello, I hope you can help me. I can't figure out how to compile this program successfully using javac.

I have two packages: p1 contains, p2 contains They're in this folder: "packages".

This is how it's structured:

- p1 -
- p2 - needs to access so it has an import p1.* statement. I keep on getting this error when I try to compile

I know something's wrong with my invocation but can anyone please correct me? I tried a lot of stuffs already but nothing seems to be working. Thank you in advance!
[ September 08, 2008: Message edited by: Denise Saulon ]

SCJP/OCPJP 6 | SCWCD/OCPJWCD 5 | OCMJEA in progress...
Ankit Garg

Joined: Aug 03, 2008
Posts: 9466

compile as

javac -d classes -cp classes p2/

as p1/A.class is in classes folder...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Denise Advincula
Ranch Hand

Joined: Jan 01, 2007
Posts: 163
It worked!! Finally I get the idea now. Thank you for your support!
I agree. Here's the link:
subject: Package Searching
It's not a secret anymore!