0

I have a JAR file, which has many dependencies (ApacheCommons stuff mostly). When I put all those JAR's in the same directory as my main JAR, everything works fine. But that makes a mess and it also means that people have to carry all those external libraries around whenever they move my program's JAR on their system.

So I put them all in a separate directory and added that directory's path to CLASSPATH environment variable (using /etc/environment). Now even though echo $CLASSPATH returns that path, still running my JAR without those libraries in the same directory causes java.lang.NoClassDefFoundError (which happens when it can't find external JARs needed).

Any help/ideas would be highly appreciated.

1 Answer 1

1

This is not really a ubuntu-Problem, see this question on stackoverflow.

The CLASSPATH-Variable does not list pathes to jar-files, but pathes to Java-class-files. To include a jav-file in a classpath you have to put jar-file filename in the classpath (e.g. CLASSPATH=/path/to/some/jar/file/jarfile.jar).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .