class not found
I created an interface ABC with some functions and then created a jar file of it.
Next i created a class DEF implementing ABC providing the jar file in the classpath:
c:\folder>javac -cp abcjar.jar DEF.java it compiles fine.
but when i give the DEF class a package 'pack' and compile:
c:\folder>javac -cp abcjar.jar pack\DEF.jar it says:
error: cannot find symbol class ABC
can anyone help
> I created an interface ABC with some functions and
> then created a jar file of it.
> Next i created a class DEF implementing ABC providing
> the jar file in the classpath:
> c:\folder>javac -cp abcjar.jar DEF.java it compiles
> fine.
>
> but when i give the DEF class a package 'pack' and
> compile:
> c:\folder>javac -cp abcjar.jar pack\DEF.jar it says:
> error: cannot find symbol class ABC
>
> can anyone help
After you added the package statement to DEF, it is under a different package from ABC. You now need to explicitly write an import statement to use ABC.
As a suggestion, do not use default packages and have a package for each class.