I have 3 classes CustomerAddress, Customer and CustomerMain.
Customer has a import statement :
import org.abc.customers.CustomerAddress;
While CustomerMain has an import statement :
import org.abc.customers.CustomerAddress;
import org.abc.customers.Customer;
The package for all of these classes are
package org.abc.customer
Now, this program works fine on eclipse but when i try to compile and run on cmd prompt it would not compile
javac CustomerAddress.java
compiles fine
then since Customer depends on CustomerAddress
I give
javac -cp . Customer.java
but the compiler complains
error cannot find symbol CustomerAddress
com.foo.bar.Amust exist within folderscom/foo/bar/.If you’re determined to build from the command line, you need to compile the independant classes first:
which should compile the classes and output them somewhere that javac will be able to resolve them from.