我试图让 apache ant 1.8 在 CentOS 下工作。首先,我有这个错误。
Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
然后我根据这个链接设置以下变量:
Ant:线程“主”java.lang.NoClassDefFoundError 中的异常:org/apache/tools/ant/launch/Launcher
它不是 CentOS,但我确实验证了除了 JAVA_HOME 之外的路径存在,所以我根据这个站点设置它:
https://serverfault.com/questions/50883/what-is-the-value-of-java-home-for-centos
现在我遇到了与第一次相同的错误。我使用哪个蚂蚁规则都没有关系,我仍然会遇到同样的错误。
[alpha:~]
[bullshark]% export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/
[alpha:~]
[bullshark]% export ANT_HOME=/usr/share/ant/
[alpha:~]
[bullshark]% export PATH=$PATH:$ANT_HOME/bin
[alpha:~]
[bullshark]% cd JRobo
[alpha:JRobo] on master
[bullshark]% ant clean-and-fat-jar
Picked up _JAVA_OPTIONS: -Xmx64m
Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
[alpha:JRobo] on master
[bullshark]% cat /etc/redhat-release
CentOS release 6.3 (Final)
[alpha:JRobo] on master
[bullshark]%
如果你想尝试,你可以在 CentOS 上克隆他:
https://github.com/BullShark/JRobo
对于 CentOS 上的 Apache Ant 1.8:
http://www.jpackage.org/browser/rpm.php?jppversion=6.0&id=11867
对于包或手动:
https://ant.apache.org/bindownload.cgi?Preferred=ftp://apache.mirrors.pair.com/