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.