Great..... I was just responding with a different soln:
'--------------- Looks like the fatjar does not include junit class. Also, the -jar option does not use the classpath environment variable. Here is an excerpt from the man page of java: -jar Execute a program encapsulated in a JAR archive. The first argument is the name of a JAR file instead of a startup class name. In order for this option to work, the manifest of the JAR file must ............ "When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored." ................ So you will have to use the main class in fatjar with the java -classpath option with all the libraries in the classpath. Java -cp log4j:junit:fatjar org.apache.zookeeper.util.FatJarMain server ....... But putting it in build and including it as part of fatjar is much more convenient!!! Thanks mahadev On 4/7/10 1:09 PM, "Vishal K" <vishalm...@gmail.com> wrote: > Hi, > > It works for me now. Just for the record, I had to copy junit*.jar to > buil/lib because fat.jar expects it to be there. Then, I had to rebuild > fatjar.jar. > > On Wed, Apr 7, 2010 at 12:10 AM, Vishal K <vishalm...@gmail.com> wrote: > >> Hi, >> >> I am trying to run systest on a 3 node cluster ( >> http://svn.apache.org/repos/asf/hadoop/zookeeper/trunk/src/java/systest/READM >> E.txt >> ). >> >> When I reach the 4th step which is to actually run the test I get exception >> shown below. >> >> Exception in thread "main" java.lang.NoClassDefFoundError: >> junit/framework/TestC >> ase >> at java.lang.ClassLoader.defineClass1(Native Method) >> at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) >> at java.lang.ClassLoader.defineClass(ClassLoader.java:616) >> at >> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14 >> 1) >> at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) >> at java.net.URLClassLoader.access$000(URLClassLoader.java:58) >> at java.net.URLClassLoader$1.run(URLClassLoader.java:197) >> at java.security.AccessController.doPrivileged(Native Method) >> at java.net.URLClassLoader.findClass(URLClassLoader.java:190) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:307) >> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:248) >> at java.lang.Class.forName0(Native Method) >> at java.lang.Class.forName(Class.java:169) >> at org.apache.zookeeper.util.FatJarMain.main(FatJarMain.java:97) >> Caused by: java.lang.ClassNotFoundException: junit.framework.TestCase >> at java.net.URLClassLoader$1.run(URLClassLoader.java:202) >> at java.security.AccessController.doPrivileged(Native Method) >> at java.net.URLClassLoader.findClass(URLClassLoader.java:190) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:307) >> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:248) >> ... 15 more >> >> Looks like it is not able to find classes in junit. However, my classpath >> is set right: >> >> >> :/opt/zookeeper-3.3.0/zookeeper.jar:/opt/zookeeper-3.3.0/lib/junit-4.4.jar:/o >> pt/ >> >> zookeeper-3.3.0/lib/log4j-1.2.15.jar:/opt/zookeeper-3.3.0/build/test/lib/juni >> t-4.8.1.jar >> >> Any suggestions how I can get around this problem? Thanks. >>