Klebson Carneiro

Greenhorn
+ Follow
since Aug 31, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Klebson Carneiro

Bert Bates wrote:The K&B book assumes that you already have your system environment stuff set up for Java. In addition to the links already suggested, you could skip ahead to the development chapter (chapter 10 I think). It talks more about this stuff.



Yes, that's true. But I use Eclipse for my projects and I had never set my CLASSPATH, it was blank till today. I just had to add "." in the CLASSPATH for my code to work :P
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
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