蚂蚁和日食 [英] Ant and Eclipse

查看:27
本文介绍了蚂蚁和日食的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名初级 Java 程序员,最近我开始阅读 Thinking in Java 4th edition 以巩固我在阅读 Head first Java 后的 Java 知识.问题是这本书有它自己的图书馆,我似乎无法即使在我做了网站指南上所说的一切之后,让它在 Eclipse 中工作.我用这个视频指南安装了 ant http://www.youtube.com/watch?v=XJmndRfb1TU 并且我收到此错误:

Hi I am a beginner java programmer and recently I've started reading Thinking in Java 4th edition to consolidate my knoledge of java after I read Head first Java.Problem is that this book has it's own library and I can't seem to make it work in eclipse even after I did everything it said on the website guide.I instaled ant acordinly with this video guide http://www.youtube.com/watch?v=XJmndRfb1TU and i'm getting this error:

无法找到tools.jar.预计在C:\Program files\Java\jre7\lib\tools.jar 中找到它构建文件:C:\TIJ4\code\build.xml

"Unable to locate tools.jar.Expected to find it in C:\Program files\Java\jre7\lib\tools.jar Buildfile:C:\TIJ4\code\build.xml

构建:

构建失败C:\TIJ4\code\build.xml:59:J2SE5 需要

BUILD FAILED C:\TIJ4\code\build.xml:59:J2SE5 required

总时间:0 秒

我尝试在论坛上建议重新安装 JDK 女巫,但它仍然没有用,所以我真的不知道该怎么做.

I tried reinstaling JDK witch was suggested on a forum but it still dident work so I don't really know what to do.

谁能告诉我如何解决这个问题?另外,更重要的是,不安装Ant,单独用Eclipse不行吗(我只用Eclipse写代码和编译所以不是很熟悉)谢谢你.

Can anyone tell me how can I solve this problem? Also, more importantly, can't this be done with Eclipse alone without installing Ant(I've only used eclipse for code writing and compiling so I'm not very familiar with it)Thant you.

推荐答案

您使用的是 JRE 而不是 JDK.安装 JDK 并将您的 PATH 和 JAVA_HOME 变量指向 JDK 主目录,而不是 JRE 主目录.

You are using a JRE instead of a JDK. Install a JDK and point your PATH and JAVA_HOME variables to the JDK home, not to the JRE home.

我看到 Ant 正在使用 JRE 中的 Java Home,例如C:\Program files\Java\jre7\但它应该是 C:\Program files\Java\jdk1.7.0\ 或类似的.

I see that Ant is using the Java Home from the JRE, e.g. C:\Program files\Java\jre7\ But it should be C:\Program files\Java\jdk1.7.0\ or similar.

检查您系统的环境变量(例如同时按Windows键和Pause,然后选择扩展设置>环境变量.检查JAVA_HOME是否设置为JDK安装路径以及PATH变量中JDK的文件夹在前面JRE 的文件夹(或使用 JDK 中的路径删除/替换 JRE 路径).

Check your system's environment variables (e.g. press Windows-Key and Pause together, then select Extended Settings > Environment Variables. Check that JAVA_HOME is set to the JDK installation path and that in the PATH variables, the folder of the JDK comes before the folder of the JRE (or remove/replace the JRE path altogether with the one from the JDK).

Ant 需要先在 PATH 中找到 JDK.

Ant needs to find the JDK first in the PATH.

这篇关于蚂蚁和日食的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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