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


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "import" Watch "import" New topic
Author

import

Ron Lam
Greenhorn

Joined: Sep 22, 2003
Posts: 6
Hi all,
I have try an example from "A programmer's Guide to Java Certification" that contain the following code snippet.

// Class Clown
package wizard.pandorasBox;
public class Clown implements Magic {
LovePotion tlc;
}

class LovePotion {

}
// Class Client
import wizard.pandorasBox.*;
public class Client {

Clown performerOne;
wizard.pandorasBox.Clown performerTwo;

// LovePotion moreTLC;
// Magic MAGICIAN;

}
The compiler complain the following when I compile Client.java:
C:\My Document\Java exercise\Chapter 4\Example 4.5\Client.java:11: cannot access Clown bad class file: C:\My Document\Java exercise\Chapter 4\Example 4.5\Clown.java file does not contain class Clown
What wrong with me?
Amit KumarS
Ranch Hand

Joined: Oct 10, 2003
Posts: 100
hiii..
it would be better understandable if you put the hierarchies of the folder where u r putting your java files and where r u compiling form.. what are names of the files..
then we would be able to help you better... by the way on first look it looks like you haven't compiled the Clown class first and second possible reson might be that you have both the classes in same folder.
correct me if i am wrong.. or give us a better view to ponder upon..
Thanks
Amit


****************************<br />In 24 hrs Earth rotates once on its Axis.
Ron Lam
Greenhorn

Joined: Sep 22, 2003
Posts: 6
Dear Amit,
Sorry for my late respond.
Both source files (Clown.java and Client.java) are located at C:\My Document\Java exercise\Chapter 4\Example 4.5\ and I have compile Clown.java first. Secondly, the class files hierarchies seems correct.
Indeed, if I change the statement "import wizard.pandorasBox.*;" to "import wizard.pandorasBox.Clown;", it does work. That means, it can locate the Clown.class from the wizard.pandorasBox.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: import