views:

209

answers:

1

I have made a directory called "middle" and inside it another directory called "tier" and inside the "tier" directory are OrderManager.java which is an interface and OrderManagerImpl.java having its implementation.

The problem is when I try to compile OrderManagerImpl.java from outside the package middle.tier it compiles but when I do the same inside the package it gives me the following error:

OrderManagerImpl.java:6: cannot find symbol
symbol: class OrderManager
public class OrderManagerImpl extends java.rmi.server.UnicastRemoteObject implements OrderManager{

Why is it so?

+6  A: 

Because the compiler expects to find your class inside the proper folder: ./middle/tier . When you try to compile inside the package, the compiler search for your class in ./middle/tier/middle/tier

fbinder
i thought that compiler serches the classpath which includes the current directory
Neal
Yes, so it will search the current directory for middle.tier.OrderManager, which means it looks for a directory called "middle" with a subdirectory called "tier" - all *under* the current directory.
Jon Skeet
thank you i got it
Neal