尝试构建文件时出现 Ant 错误,找不到 tools.jar? [英] Ant error when trying to build file, can't find tools.jar?

查看:36
本文介绍了尝试构建文件时出现 Ant 错误,找不到 tools.jar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行 ant 时,它说:

When I run ant it says:

Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar
Buildfile: build.xml does not exist!
Build failed

我可以使用什么包来下载所需的文件 > C:\Program Files\Java\jre6\lib\tools.jar

What package can I use to download the file required > C:\Program Files\Java\jre6\lib\tools.jar

我刚刚下载了这个:

jre-6u19-windows-i586-s.exe

jre-6u19-windows-i586-s.exe

但不幸的是,它似乎不在上面......

but unfortunately it appears that it was not on it...

推荐答案

Java 有 2 个版本:JRE &SDK(以前叫JDK)

Java ships in 2 versions: JRE & SDK (used to be called JDK)

JRE 除了不包含编译器,也不包含 JDK 中可用的所有库(tools.jar 就是其中之一)

The JRE in addition to not containing the compiler, also doesn't contain all of the libraries available in the JDK (tools.jar is one of them)

当您在以下位置下载 Java 时:http://java.sun.com/javase/downloads/index.jsp,确保选择JDK版本并安装.如果您同时拥有 JDK 和JRE,确保ANT正在使用JDK,您可以检查JAVA_HOME(环境变量),如果您在命令行中执行javac -version",您应该得到版本描述.

When you download Java at: http://java.sun.com/javase/downloads/index.jsp, make sure to select the JDK version and install it. If you have both a JDK & JRE, make sure that ANT is using the JDK, you can check JAVA_HOME (environment variable), and on the commandline if you do "javac -version" you should get a version description.

这篇关于尝试构建文件时出现 Ant 错误,找不到 tools.jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆