Are they in the right subdirectories?
If you put /usr/share/stuff
on the class path, files defined with package org.name
should be in /usr/share/stuff/org/name
.
EDIT: If you don't already know this, you should probably read this doc about understanding classpath.
EDIT 2: Sorry, I hadn't realised you were talking of Java source files in /usr/share/stuff
. Not only they need to be in the appropriate sub-directory, but you need to compile them. The .java
files don't need to be on the classpath, but on the source path. (The generated .class
files need to be on the classpath.)
You might get away with compiling them if they're not under the right directory structure, but they should be, or it will generate warnings at least. The generated class files will be in the right subdirectories (wherever you've specified -d
if you have).
You should use something like javac -sourcepath .:/usr/share/stuff test.java
, assuming you've put the .java
files that were under /usr/share/stuff
under /usr/share/stuff/org/name
(or whatever is appropriate according to their package names).