I built an executable jar using an ant script, the only external jar I used was joda-time 2.0. The ant build script \"seemed\" to work as I did not recieve any compile error
Unless you're using a custom classloader or something like JarJar, then you cannot bundle external JARs inside your executable JAR. Your manifest file will need to list a classpath, but the JVM will look for the JARs you list in the same directory as your executable JAR, not inside your executable JAR.
Presumably, your jar doesn't contain a manifest header telling Java to add the joda-time jar to the classpath. That's the only way to have other classpath entries when using java -jar
. You could do this directly with the Ant manifest task, or there are probably multiple other ways to do it, including building it from your existing classpath.
Alternately, try
java -cp myapp.jar:joda-time-2.0.jar com.foo.YourMainClass