Understanding packaging
I have three sets of java coding with the following packaging and import statements:
Date.java
package com.deitel.jhtp3.ch08;
Employee.java
package com.deitel.jhtp3.ch08;
EmployeeTest.java
import com.deitel.jhtp3.ch08.Employee
Both Date.java and Employee.java are located in this subfolder:
c:\JavaWork\com\deitel\jhtp3\ch08
Meanwhile Employee is located in the following parent folder:
c:\JavaWork
My classpath is set this way:
set classpath=c:\JavaWork
I'm attempting to follow the example exactly as shown in my study book. I've compiled Date.java without any problem. However, my attempt to compile Employee.java doesn't work and I get this error message:
/*
C:\JavaWork\com\deitel\jhtp3\ch08\Employee.java:8: cannot resolve symbol
symbol : class Date
location: class com.deitel.jhtp3.ch08.Employee
private Date birthDate;
*/
I don't understand what the problem may be. I've tried moving Employee.java up the line a bit by putting it in the "deitel" folder. Then I included an import statement for it as well as changed the packaging statement for Date.java. But it still doesn't work. Please help me understand what will "always" work.
[1444 byte] By [
vaschons] at [2007-9-26 3:00:54]

okay, just to clarify, everything initially starts with EmployeeTest.java which calls upon (or imports) Employee.java. Now Employee.java can't really do it's deal without the help of Date.java. So it makes since to attempt to compile them in the reverse order.
Date.java compiles just fine. However, Employee.java will not compile - giving me an error message saying that it cannot find Date.class, although they are in the exact same subfolder folder.
I haven't even gotten to EmployeeTest.java yet since I know it cannot possibly compile without the help of Employee.java. Should the two modules in the subdirectory not be in the same folder?
> I haven't even gotten to EmployeeTest.java yet since
> I know it cannot possibly compile without the help of
> Employee.java.
Not quite right; if EmployeeTest uses Employee and Date (directly or not) javac will automatically compile them. It's not like in C or C++ ... The order in which you compile files makes no difference in java. But do delete the file Date.class first.
> Date.java compiles just fine.
Even if you don't get warnings or compile errors it still may be compiled in the wrong way... See above for the correct way to compile it.
(and, like Partha Sarkar said, it would be good to include "." in the classpath, if you want to work in other directories than c:\java)