Apache Ant的找不到或加载主类org.apache.tools.ant.launch.Launcher

问题描述 投票:7回答:4

我试图编译它在Linux上使用Apache Ant的工具

https://github.com/lindenb/jvarkit

当我试图编译工具,我得到n个错误。

$ make vcffilterjs

这是我所得到的,当我运行命令

echo "Compiling htsjdk with ${JAVA_HOME} = /usr/lib/jvm/java/jre/"
Compiling htsjdk with /usr/lib/jvm/java/jre/ = /usr/lib/jvm/java/jre/
echo "Compiling htsjdk library for java. Requires  apache ANT. If it fails      here, it's a not a problem with jvarkit."
Compiling htsjdk library for java. Requires  apache ANT. If it fails here,  it's a not a problem with jvarkit.
echo "And ${JAVA_HOME}/bin/javac should be >=1.7"
And /usr/lib/jvm/java/jre//bin/javac should be >=1.7
(cd /home/jannahS/jvarkit/htsjdk-1.139 && ant )
Error: Could not find or load main class  org.apache.tools.ant.launch.Launcher
make: *** [/home/jannahS/jvarkit/htsjdk-1.139/dist/htsjdk-1.139.jar] Error 1

我已经安装了Apache Ant和试图设置ANT_HOME以下指令谷歌

export ANT_HOME=apache-ant-1.9.6
ANT_OPTS="-Xms256M -Xmx512M"
PATH=$PATH:$HOME/bin:$ANT_HOME/bin
export ANT_HOME ANT_OPTS PAT

我还设置JAVA_HOME

export JAVA_HOME=/usr/lib/jvm/jre-1.7.0
export PATH=$JAVA_HOME/jre/bin:$PATH

当我运行

蚂蚁--execdebug

exec "/usr/lib/jvm/java/jre//bin/java" -Xmx256M -classpath "apache-ant-  1.9.6/lib/ant-launcher.jar" -Dant.home="apache-ant-1.9.6" -Dant.library.dir="apache-ant-1.9.6/lib" org.apache.tools.ant.launch.Launcher -cp ""
Buildfile: build.xml does not exist!
Build failed

我不知道该做些什么,以使事情工作。我不能编译,我想没有Apache Ant的使用工具

java linux ant
4个回答
6
投票

使用完整路径ANT_HOME,如:

export ANT_HOME=/usr/lib/apache-ant-1.9.6

这要看它是精确定位


4
投票

无法找到或加载主类org.apache.tools.ant.launch.Launcher

在Mac,如果你使用BREW命令安装的蚂蚁,这是由于一些环境问题,

从蚂蚁复制lib文件夹并将其粘贴到bin文件夹

现在运行命令的问题解决了:-)

问题原因

蚂蚁试图从无效的路径bin/lib/ant-launcher.jar文件


0
投票

在Mac上,运行brew install ant后,我还得跑brew link ant充分链接蚂蚁系统环境。

运行brew link --verbose --overwrite ant我得到:

Linking /usr/local/Cellar/ant/1.10.5... 
ln -s ../Cellar/ant/1.10.5/bin/ant ant
ln -s ../Cellar/ant/1.10.5/bin/antRun antRun
ln -s ../Cellar/ant/1.10.5/bin/antRun.pl antRun.pl
ln -s ../Cellar/ant/1.10.5/bin/complete-ant-cmd.pl complete-ant-cmd.pl
ln -s ../Cellar/ant/1.10.5/bin/runant.pl runant.pl
ln -s ../Cellar/ant/1.10.5/bin/runant.py runant.py
6 symlinks created

运行“蚁族”时,没有通过命令行PARAMS:

Buildfile: build.xml does not exist!
Build failed

这就是我希望如果现有Ant项目的环境之外的测试。


-1
投票

$ make vcffilterjs:编译OK,任何与这些 “Linux的OS's” 的:

的Debian 8杰西,CentOS的7的Fedora 23,Ubuntu的15.10,PCLinuxOS的2015。

无需“ANT_HOME”或“JAVA_HOME”设置,通过使用安装“蚁族”和OpenJDK的默认值。

?其中“Linux操作系统”您使用的?


© www.soinside.com 2019 - 2024. All rights reserved.