執行ant build-db-userprofile
(tutorial I'm following)時,我得到java.lang.ClassNotFoundException: org.apache.bsf.engines.javascript.JavaScriptEngine
。獲取Java ClassNotFoundException for JavaScriptEngine
顯然,當BSF的.jar不存在於這個$ANT_HOME/lib
造成但是當我執行ls -l $ANT_HOME/lib && ant -version
我得到如下:
-bash-4.1$ ls -l $ANT_HOME/lib
total 0
lrwxrwxrwx. 1 root root 28 May 30 10:03 ant-antlr.jar -> ../../java/ant/ant-antlr.jar
lrwxrwxrwx. 1 root root 34 May 30 10:03 ant-apache-bcel.jar -> ../../java/ant/ant-apache-bcel.jar
lrwxrwxrwx. 1 root root 33 May 30 10:03 ant-apache-bsf.jar -> ../../java/ant/ant-apache-bsf.jar
lrwxrwxrwx. 1 root root 35 May 30 10:03 ant-apache-log4j.jar -> ../../java/ant/ant-apache-log4j.jar
lrwxrwxrwx. 1 root root 33 May 30 10:03 ant-apache-oro.jar -> ../../java/ant/ant-apache-oro.jar
lrwxrwxrwx. 1 root root 36 May 30 10:03 ant-apache-regexp.jar -> ../../java/ant/ant-apache-regexp.jar
lrwxrwxrwx. 1 root root 38 May 30 10:03 ant-apache-resolver.jar -> ../../java/ant/ant-apache-resolver.jar
lrwxrwxrwx. 1 root root 28 May 30 10:02 ant-bootstrap.jar -> ../../java/ant-bootstrap.jar
lrwxrwxrwx. 1 root root 38 May 30 10:03 ant-commons-logging.jar -> ../../java/ant/ant-commons-logging.jar
lrwxrwxrwx. 1 root root 34 May 30 10:03 ant-commons-net.jar -> ../../java/ant/ant-commons-net.jar
lrwxrwxrwx. 1 root root 18 May 30 10:02 ant.jar -> ../../java/ant.jar
lrwxrwxrwx. 1 root root 31 May 30 10:03 ant-javamail.jar -> ../../java/ant/ant-javamail.jar
lrwxrwxrwx. 1 root root 30 May 30 10:03 ant-jdepend.jar -> ../../java/ant/ant-jdepend.jar
lrwxrwxrwx. 1 root root 27 May 30 10:03 ant-jsch.jar -> ../../java/ant/ant-jsch.jar
lrwxrwxrwx. 1 root root 28 May 30 10:03 ant-junit.jar -> ../../java/ant/ant-junit.jar
lrwxrwxrwx. 1 root root 27 May 30 10:02 ant-launcher.jar -> ../../java/ant-launcher.jar
lrwxrwxrwx. 1 root root 29 May 30 10:02 ant-nodeps.jar -> ../../java/ant/ant-nodeps.jar
lrwxrwxrwx. 1 root root 28 May 30 10:03 ant-swing.jar -> ../../java/ant/ant-swing.jar
lrwxrwxrwx. 1 root root 27 May 30 10:03 ant-trax.jar -> ../../java/ant/ant-trax.jar
-bash-4.1$
-bash-4.1$ ant -version
Apache Ant version 1.7.1 compiled on May 10 2016
已使用JDK 1.6 <提到的另一種可能性,但我使用JDK 7.0_79。我ANT_HOME和ANT_OPTS ENV瓦爾設置如下:
ANT_HOME=/usr/share/ant ANT_OPTS=-server -XX:MaxPermSize=256M -Xmx1000m -XX:+UseParallelGC -Xms1000m -XX:SoftRefLRUPolicyMSPerMB=1 -XX:MaxHeapFreeRatio=99
該軟鏈接是活動還是中斷? –
@BhargavKumarR對不起,我沒有關注/理解這個問題。 – player87
ant-apache-bsf.jar - > ../../java/ant/ant-apache-bsf.jar該路徑是否有效? –