java.lang.ClassNotFoundException when running java -jar
问题 I'm using ant to build my build.xml file, it compiles ok, but then getting a runtime java.lang.NoClassDefFoundError when running the resulting jar via " java -jar my_jar.jar ". It seems like this comes up a lot but none of the related questions' solutions worked for me. My classpath for javac contains only " /usr/local/lib/libthrift.jar " and the main .java file imports a bunch of thrift packages such as org.apache.thrift.transport.TTransportException . When I try running the program via: