How to set the classpath in java in ubuntu and how to work with jar?

Viewed 16551

I'm trying to import the class from jar files. I want to place all of the jar files in the directory:

/home/somebody/lib/java/

Compiling with the command given below says:

package com.a.A does not exits**. java C.java

I set the following in profile.

CLASSPATH=/home/somebody/lib/java

then exported it. Added to PATH as well

C.java

import com.a.A;
import com.a.AA;
import com.b.B;
import com.b.BB;

class B {
    public static void main() {
        new A();
        new AA();
        new B();
        new BB();
    }
}

the classfiles are in the following jar_file a.jar and b.jar.

2 Answers
Related