我无法运行项目lib /目录中jar文件中的main()。
蚂蚁目标是:
<target name="testTarget">
<java jar="lib/test-jar-1.1.jar" fork="on" />
</target>
异常跟踪是:
[java] java.lang.NoClassDefFoundError: com/google/common/base/Predicate
[java] Caused by: java.lang.ClassNotFoundException: com.google.common.base.Predicate
[java] at java.net.URLClassLoader$1.run(Unknown Source)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClass(Unknown Source)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
[java] Could not find the main class: com.test.framework.startup.Startup. Program will exit.
[java] Exception in thread "main"
[java] Java Result: 1
我的claspath中已经有了番石榴
<pathelement location="lib/guava-14.0.jar" />
请帮我解决问题。
答案 0 :(得分:1)
将classpath或classpathref传递给java任务。 http://ant.apache.org/manual/Tasks/java.html
答案 1 :(得分:0)