JAVA_HOME是否应指向JDK或JRE? [英] Should JAVA_HOME point to JDK or JRE?

查看:1094
本文介绍了JAVA_HOME是否应指向JDK或JRE?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将JAVA_HOME指向C:\Program Files (x86)\Java\jre7.它工作正常.之后,我解压缩了ant并设置了与Ant有关的环境变量,在键入"ant -version"

I pointed the JAVA_HOME to C:\Program Files (x86)\Java\jre7. It works fine. Afterwards, I unzipped ant and set up the environment variables related to Ant, I got the following error messages after typing "ant -version"

我搜索了这个论坛.似乎一种解决方案是将Java指向JDK而不是JRE.我不确定这是否是解决方案.换句话说,一般来说,JAVA_HOME应该指向哪一个?是JDK还是JRE?

I searched this forum. Looks like one solution is to point Java to JDK instead of JRE. I am not exactly sure whether this should be the solution. In other words, in general, which one should JAVA_HOME point to? JDK or JRE?

推荐答案

如果您正在进行任何类型的开发,或者使用Maven或Ant进行构建,则需要指向JDK(Java开发工具包),其中包含诸如javac(Java编译器)驻留.否则,您可以指向JRE(Java运行时环境).

If you're doing any sort of development, or building with Maven or Ant, you need to point to the JDK (Java Development Kit) where utilities such as javac (the Java Compiler) reside. Otherwise, you can point to the JRE (Java Runtime Environment).

JDK包含JRE拥有的所有内容以及更多内容.如果您只是在执行Java程序,则可以指向JRE或JDK.

The JDK contains everything the JRE has and more. If you're just executing Java programs, you can point to either the JRE or the JDK.

这篇关于JAVA_HOME是否应指向JDK或JRE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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