java 其中哪些是我的 JDK 路径,哪些是 JAVA_HOME?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12156280/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Which of these is my JDK path, and which is JAVA_HOME?
提问by IAmYourFaja
I just installed Linux Mint and am trying to configure SpringSource Tool Suite which requires you to direct it to the system "JDK path". Although I haven't explicitly downloaded/installed Java on this system yet, when I ran the update manager I did see Open JDK get installed and found several directories under /usr/lib/jvm
(see screenshot below). My questions are:
我刚刚安装了 Linux Mint 并且正在尝试配置 SpringSource Tool Suite,这要求您将其定向到系统“JDK 路径”。虽然我还没有在这个系统上明确下载/安装 Java,但当我运行更新管理器时,我确实看到安装了 Open JDK 并在/usr/lib/jvm
下面找到了几个目录(见下面的截图)。我的问题是:
- Spring Tool Suite requires you to specify a path to the JDK, and my question is, which one do I choose, and why?; and
- How do I tell which of these is my
JAVA_HOME
?; and - What's the difference between the "JDK path" and
JAVA_HOME
?
- Spring Tool Suite 要求您指定 JDK 的路径,我的问题是,我选择哪个,为什么?和
- 我怎么知道哪些是我的
JAVA_HOME
?和 - “ JDK 路径”和“ JDK 路径”有什么区别
JAVA_HOME
?
Thanks in advance!
提前致谢!
Edit:
编辑:
echo $PATH --> /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
java -version -> java version "1.7.0_03" OpenJDK Runtime Environment (IcedTea7 2.1.1pre) (7~u3-2.1.1~pre1-1ubuntu3) OpenJDK 64-Bit Server VM (build 22.0-b10, mixed mode)
which java -> /usr/bin/java
echo $PATH --> /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
java -version -> java version "1.7.0_03" OpenJDK Runtime Environment (IcedTea7 2.1.1pre) (7~u3-2.1.1~pre1-1ubuntu3) OpenJDK 64-Bit Server VM (build 22.0-b10,混合模式)
哪个 java -> /usr/bin/java
采纳答案by Kevin Sitze
Spring Tool Suite requires you to specify a path to the JDK, and my question is, which one do I choose, and why?; and
Spring Tool Suite 要求您指定 JDK 的路径,我的问题是,我选择哪个,为什么?和
This can only be answered according to the needs of your application. Do you need the stability of Java 6 or the features added in Java 7? Are there APIs you intend to use that are only available in Java 7 or are the Java 6 libraries sufficient? Do you have customers that require the use of one JVM over another? Only you can answer these questions.
这只能根据您的应用程序的需要来回答。您需要 Java 6 的稳定性还是 Java 7 中添加的功能?是否有您打算使用的 API 仅在 Java 7 中可用,或者 Java 6 库是否足够?您是否有客户要求使用一种 JVM 而非另一种?只有你能回答这些问题。
How do I tell which of these is my JAVA_HOME?; and
我如何判断哪些是我的 JAVA_HOME?和
You will want to make JAVA_HOME reference the specific JVM environment that you've decided on for your project. For example, if you decide on Java 6 you'll probably want to set your JAVA_HOME to /usr/lib/jvm/java-6-openjdk-amd64.
您需要让 JAVA_HOME 引用您为项目决定的特定 JVM 环境。例如,如果您决定使用 Java 6,您可能希望将 JAVA_HOME 设置为 /usr/lib/jvm/java-6-openjdk-amd64。
What's the difference between the "JDK path" and JAVA_HOME?
“JDK路径”和JAVA_HOME有什么区别?
The JDK path refers to the Java Development Kit - which includes the java compiler, debugger and other tools associated with developing java programs. JAVA_HOME can reference either the JDK root or the JRE (Java Runtime Environment) root directory when running java programs; but you should, for development purposes, always have JAVA_HOME reference the JDK root.
JDK 路径指的是 Java 开发工具包——它包括 Java 编译器、调试器和其他与开发 Java 程序相关的工具。JAVA_HOME 运行java程序时可以引用JDK根目录,也可以引用JRE(Java Runtime Environment)根目录;但出于开发目的,您应该始终让 JAVA_HOME 引用 JDK 根目录。