Compiling Package, cannot find symbol
Hello everyone,
I've been trying to get my package to work but I keep running into a cannot find symbol error. Since this is a homework assignment, I'll just use broad examples to describe my problem. Let's assume that I have these files...
In the upper level folder:
Food.java
Code java:
public class Food{
private Fruits<String> fruits;
private Vegetables<String> vegetables;
public Food(){
fruits = new Fruits<String>();
vegetables = new Vegetables<String>();
}
...
}
In the lower level folder, let's assume it's called type:
Fruits.java
Vegetables.java
In the Fruits.java and Vegetables.java, I have the line package type; declared.
When compiling, I'm using the command:
javac type/Fruits.java
javac type/Vegetables.java
*note* The two files compile fine without error
When I try: javac Food.java
Code java:
Food.java:7: cannot find symbol
symbol : class Fruits
location: class Food<E>
private Fruits<String> fruits;
^
Food.java:8: cannot find symbol
symbol : class Vegetables
location: class Food<E>
private Vegetables<String> vegetables;
^
Food.java:11: cannot find symbol
symbol : class Fruits
location: class Food<E>
fruits = new Fruits<String>();
^
Food.java:12: cannot find symbol
symbol : class Vegetables
location: class Food<E>
vegetables = new Vegetables<String>();
^
4 errors
Any input is appreciated and thanks for your time, Actinistia.
*edit* I figured out that I had bad class files in my directory. I recompiled it and it worked out fine. Sorry for the inconvenience.
Re: Compiling Package, cannot find symbol
You need to provide an SSCCE that demonstrates exactly what you're doing- the code you posted does not generate the error you're talking about, and we need to know exactly how you're declaring your packages and classes.