Hi Zak!
On Jun 15, 10:04 am, Zak Wilson <
zak.wil...@gmail.com> wrote:
> The .deb drops it in /usr/share/java/ which seems like the sort of
> place that would be in the default classpath.
When JVM starts, it needs to be told explicitly where to look
for .class files. It can look in .jar files or in directories. Note
the subtle distinction: you're telling JVM where to look for .class
files, NOT .jar files. WRT to finding .class files, jar files are the
same thing as directories. If you put a directory in the CLASSPATH,
JVM will search for class definitions in that directory but not in
the .jar files in that directory.
For example, if you have a directory with the following content:
mylibs/
mylibs/org/apache/SomeClass.class
mylibs/serial.jar
and you put directory mylibs in your classpath, then when the JVM
looks for class org/apache/SomeClass, it will find it because mylibs
is in the classpath, and relative to it file org/apache/
SomeClass.class can be found. On the other hand, *nothing* from the
serial.jar is visible. To be able to find classes from serial.jar,
you need to add serial.jar to the classpath the same way you added
directoy mylibs. Therefore, your CLASSPATH will need to look
something like: 'mylibs:mylibs/serial.jar' (colon is a separator).
I hope this makes it clear why putting a directory full of .jar files
into your classpath does not make the classes within those .jar files
available. You need to put all the jar files explicitely. Nobody
puts all the files from /usr/share/java in their classpath. That's
just a repository of available stuff, and applications decide which
ones to use.
To actually set the classpath, you can use either '-cp' option when
you start JVM or CLASSPATH environment variable.
> According to the
> documentation on the wiki Dustin linked, the jar should go in /usr/lib/
> jvm/java-6-sun-1.6.0.06/jre/lib/ext/.
The JVM itself has some jar files which constitute the base of the
system, and those jar files are in directory such as the one you
mention above. It is definitely not the place in which you're
expected to put your stuff.
Hope this helps.