1

In the dev/proj/app/test.java file I have:

package proj.app;
...
import lib.sec.x;
...

In the /classes/proj/lib/sec I have x.class file.

When I try to compile java:

javac -classpath "/classes/proj/*" test.java

I got this error message:

package lib.sec does not exist

How to reference x.class file within classpath?

Zoran Kalinić
  • 317
  • 2
  • 10
  • 23

1 Answers1

1

The Java package is part of the (fully-qualified) class name. This

javac -classpath "/classes/proj/*" test.java

should be something like

javac -classpath "/classes:/classes/proj" proj/app/test.java

But your really shouldn't put lib (if it's a package name) under proj (a different package), the lib folder should be moved under classes. And then you only need /classes in the classpath.

Elliott Frisch
  • 198,278
  • 20
  • 158
  • 249