aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Excercise 1-1 from Kathy Sierra, Bert Bates Study Guide 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 » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Excercise 1-1 from Kathy Sierra, Bert Bates Study Guide" Watch "Excercise 1-1 from Kathy Sierra, Bert Bates Study Guide" New topic
Author

Excercise 1-1 from Kathy Sierra, Bert Bates Study Guide

Preet Dhillon
Greenhorn

Joined: May 20, 2008
Posts: 24
I am really embarrassed to report that I am stuck on Exercise 1-1

I get the following error when I go to compile Apple.java:
Package food does not exist.


I have my JDK installed on my c rogram files\Java\jdk1.6.0_06\bin
My class files are located in: H:\ Java\SCJP\Apple.java and H:\ Java\SCJP\food\Fruit.java and Fruit.class

I have CLASSPATH set to h:\Java\SCJP

Any ides what I'm doing wrong.
Thanks in advance
Brian Legg
Ranch Hand

Joined: Nov 07, 2008
Posts: 488
Before I start guessing could you post the code you are using in it's entirety as well?


SCJA
~Currently preparing for SCJP6
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9305
    
  17

Kanwal everything looks fine as far as you have posted. Please post the exact steps through which you compiled the files...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Klebson Carneiro
Greenhorn

Joined: Aug 31, 2011
Posts: 3
After 3 years, he did not reply, but I got stuck in the same problem :P

1st file: Fruit.java


Compiled with no errors, through:
javac Fruit.java

2nd file: Apple.java


Does not compile, through:
javac Apple.java

Error:
Apple.java:1: package food does not exist
import food.Fruit;

Both .java files are in the same folder
Klebson Carneiro
Greenhorn

Joined: Aug 31, 2011
Posts: 3
The solution is in this same forum:

http://www.coderanch.com/t/269257/java-programmer-SCJP/certification/Exercise

1st:
javac -d . Fruit.java
(food folder is created with Fruit.class inside)

then
javac -classpath . Apple.java
or
add . to CLASSPATH and
javac Apple.java
 
 
subject: Excercise 1-1 from Kathy Sierra, Bert Bates Study Guide