aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Exercise 2.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Exercise 2.1" Watch "Exercise 2.1" New topic
Author

Exercise 2.1

Philip Washburn
Greenhorn

Joined: Mar 31, 2004
Posts: 1
I was unable to get the code for Apple.java to compile in exercise 2.1 of the Sun Certified Programmer & Developer study guide:
Apple.java
import food.Fruit;
public class Apple extends Fruit{}
Fruit.java (in subdirectory food)
package food;
public abstract class Fruit{}

The compiler say "package food does not exist". What am I doing wrong?
Richard Quist
Ranch Hand

Joined: Feb 18, 2004
Posts: 96
assuming you're in the directory that has Apple.java and food is a subdirectory of it, this should work:
javac -classpath . Apple.java


Rich
SCJP 1.4
Giuoco Krag
Greenhorn

Joined: Mar 23, 2004
Posts: 10
Originally posted by Philip Washburn:
package food;
public abstract class Fruit{}

The compiler say "package food does not exist". What am I doing wrong?

Also, make sure your directory structure is properly set up. Depending on where you compile your code, I think your source must be in a directory named food.
? does this make sense ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exercise 2.1