JAVA_HOME 应该指向 JDK 还是 JRE? [英] Should JAVA_HOME point to JDK or JRE?

查看:58
本文介绍了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天全站免登陆