Saeid Yazdani Saeid Yazdani - 2 months ago 10x
Java Question

Adding a library to Java CLASSPATH in Ubuntu

I am not sure if my question is more related about Ubuntu or Java, so pardon me!

I am trying to compile a java program but I get the following error:

package javax.comm does not exist

I have downloaded the required package
but I do not know how/where should I install/copy this file.

I read somewhere that this should be in
folder but I dont have this folder.

This is what I get for
java -version
I guess this means I have already installed Java in my system:

java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.4) (6b24-1.11.4-1ubuntu0.12.04.1)
OpenJDK Server VM (build 20.0-b12, mixed mode)

I also have these folders in

default-java java-1.7.0-openjdk-i386 java-6-openjdk-i386
java-1.6.0-openjdk java-6-openjdk java-7-openjdk-common
java-1.6.0-openjdk-i386 java-6-openjdk-common java-7-openjdk-i386


Typically you specify the classpath when you start your java program with the switch java -cp your.jar

But you can also permanently add it to your java installation by copying the jar to the default-java/jre/lib/ext folder.

Finally take a look at this question: Setting multiple jars in java classpath