ant 安装过程中问题记录

最近在本机安装ant过程中出现一些问题,在此记录一下。

 

1、Unable to locate tools.jar. Expected to find it in C:/Program Files/Java/jre
命令行敲ant命令后提示:“Unable to locate tools.jar. Expected to find it in C:/Program Files/Java/jre6/li”;

查看ANT_HOME环境变量已经配置;

解决途径:将“C:/Program Files/Java/jdk1.6.0_16/lib”目录下的tools.jar文件拷贝到“C:/Program Files/Java/jre6/lib”目录下,重新运行命令ant,运行正常,问题解决。

 

2、build文件中无法执行scp或sshexec(用于远程连接linux服务器)

D:\Program Files\apache-ant-1.9.4\build.xml:32: Problem: failed to create task or type sshexec
Cause: Could not load a dependent class com/jcraft/jsch/Logger
It is not enough to have Ant's optional JARs
you need the JAR files that the optional tasks depend upon.
Ant's optional task dependencies are listed in the manual.
Action: Determine what extra JAR files are needed, and place them in one of:
-D:\Program Files\apache-ant-1.9.4\lib
-C:\Users\yu\.ant\lib
-a directory added on the command line with the -lib argument

Do not panic, this is a common problem.
The commonest cause is a missing JAR.

This is not a bug; it is a configuration problem

在网上查找许多解决方法,基本上都是jar包的事,比如jsch.jar非最新版本。

使用的版本“apache-ant-1.9.4”,由于机器上第一次安装后是运行没有问题,重装系统后再次运行时出现上述问题。故思考将原来的压缩包,重新解压一下试试。然后神奇的,再次执行正常,未报上述错误。暂时解决。


posted @ 2015-08-18 10:37  milkty  阅读(1238)  评论(0编辑  收藏  举报