Zoran Kalinić
Zoran Kalinić

Reputation: 317

Setting Javac classpath

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?

Upvotes: 1

Views: 5052

Answers (1)

Elliott Frisch
Elliott Frisch

Reputation: 201429

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.

Upvotes: 1

Related Questions