apache-ant无法找到或加载主类org.apache.tools.ant.lonchLauncher



我正在尝试编译一个在linux 上使用apacheant的工具

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

我已经安装了apacheant,并尝试按照谷歌指令设置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

当我运行时

ant—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 ,我就无法编译我想要使用的工具

在ANT_HOME中使用完整路径,例如:

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

它取决于它的确切位置

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

在mac中,这是由于一些环境问题,如果你使用brew命令安装蚂蚁,

从ant复制lib文件夹并将其粘贴到bin文件夹中

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

问题原因

ant正试图从无效路径获取bin/lib/ant-launcher.jar文件

在Mac中,在运行brew install ant之后,我必须运行brew link ant才能将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

当从命令行运行没有参数的"ant"时:

Buildfile: build.xml does not exist!
Build failed

如果在现有ant项目的上下文之外进行测试,这就是我所期望的。

  1. 运行"哪只蚂蚁">gt;想知道蚂蚁是否集合了。如果没有,请使用相应的路径在下面运行以设置ant_home

导出ANT_HOME=/ade_autofs/gd29_3rdparty/ANT_1.7.1_GENERIC.rdd/080925/ANT导出路径=/ade_autofs/gd29_3rdparty/ANT_1.7.1_GENERIC.rdd/080925/ANT:${PATH}

尝试蚂蚁构建。它应该可以正常工作,没有任何错误。

"我同意以上问题的完整路径问题,在文件夹有访问问题时得到相同的异常"

我在Macbook也遇到过同样的例外。检查了ANT相关jar中的所有配置JAVA_HOME、ANT_HOME和org.apache.tools.ANT.launchLauncher文件。最后,发现了由于apacheant文件夹的访问问题而导致的问题。我没有管理员权限,所以我把我的设置移到了桌面上。


$ make vcffilterjs:编译正常,使用以下任何"Linux操作系统":

Debian 8 Jessie,CentOS 7,Fedora 23,Ubuntu 15.10,PCLinuxOS 2015。

通过使用默认安装的"ANT"和openjdk,不需要"ANT_HOME"或"JAVA_HOME)设置。

您使用的是哪种"Linux操作系统"?


antjvarkit

最新更新