java JDK 的主目录是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38410167/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 03:22:34  来源:igfitidea点击:

What is the home directory for JDK?

java

提问by Akash Gupta

I am having a problem in selecting home directory for JDK. Even though I have selected the following path: "C:\Program Files (x86)\Java\jre1.8.0_91", it keeps showing the error: "The selected directory is not a valid home for JDK". My java folder has two folders- bin and lib. Window for selecting home directory

我在为 JDK 选择主目录时遇到问题。即使我选择了以下路径:“C:\Program Files (x86)\Java\jre1.8.0_91”,它仍然显示错误:“所选目录不是 JDK 的有效主页”。我的 java 文件夹有两个文件夹 - bin 和 lib。 选择主目录的窗口

Kindly help me in selecting home directory. Thank you!

请帮助我选择主目录。谢谢!

回答by Aaron

You have currently located a JRE, or Java Runtime Environment. That does indeed contain a javaexecutable and can launch JVMs, but it's not made for development, rather more as a "Java client". For example if you look into it's /binfolder, you won't find the javacexecutable needed for compiling.

您当前已找到 JRE 或 Java 运行时环境。它确实包含一个java可执行文件并且可以启动 JVM,但它不是为开发而设计的,而更像是一个“Java 客户端”。例如,如果您查看它的/bin文件夹,您将找不到javac编译所需的可执行文件。

What you need is a JDK, or Java Development Toolkit. It contains all the JRE contains, with additional tools for development. You can find it for download on the Oracle website.

您需要的是 JDK 或 Java 开发工具包。它包含所有 JRE 所包含的内容,以及用于开发的附加工具。您可以在Oracle 网站上找到它以供下载。

回答by Abhay

Your home directory will jdk not jre. If your jdk is installed properly then there will be a jdk folder. Try setting C:\Program Files (x86)\Java\jdk1.8.0_91\bin

你的主目录是 jdk 而不是 jre。如果您的 jdk 安装正确,则会有一个 jdk 文件夹。尝试设置 C:\Program Files (x86)\Java\jdk1.8.0_91\bin

回答by VatsalSura

Your home directory for JDK would be "C:\Program Files (x86)\Java\jre1.8.0_91\bin"

您的 JDK 主目录将是 "C:\Program Files (x86)\Java\jre1.8.0_91\bin"

回答by Méhdi Màick

try this on windows to know the home of your jdk

在 Windows 上试试这个以了解你的 jdk 的家

c:\> for %i in (java.exe) do @echo.   %~$PATH:i