java 无法下载 JDK 8
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48049786/
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
Can't download JDK 8
提问by RealAnyOne
I'm trying to setup Unity to build for Android. But I can't get the Java Development Kit. Can't download it and can't find it either.
我正在尝试设置 Unity 来为 Android 构建。但是我无法获得 Java 开发工具包。无法下载,也找不到。
In this answer, the guy says
在这个答案中,这家伙说
To ensure JDK is installed, just go through the following : press Win + R type 'cmd' in the popup and press button OK. in the console which has opened, type javac -version and press enter. You should see as an output : javac 1.8.0_XX If so SDK is installed.
要确保安装了 JDK,只需执行以下操作:按 Win + R 在弹出窗口中键入“cmd”,然后按“确定”按钮。在打开的控制台中,输入 javac -version 并按回车键。您应该看到如下输出: javac 1.8.0_XX 如果安装了 SDK。
I did that and I got "javac 1.8.0_XX", and so I assumed I had the JDK, so I went to Unity > External Tools > JDKand tried linking the following path: "C:\Program Files\Java\jre1.8.0", and got the error message: "The path you specified does not look like a valid JDK installation. Android development requires at least JDK(1.7), having JRE only is not enough. Please make sure you are selecting a suitable JDK home directory or download and install the latest JDK: link"
我这样做了,我得到了“javac 1.8.0_XX”,所以我假设我有 JDK,所以我去Unity > External Tools > JDK并尝试链接以下路径:“C:\Program Files\Java\jre1. 8.0”,并收到错误消息:“您指定的路径看起来不像是有效的 JDK 安装。Android 开发至少需要 JDK(1.7),只有 JRE 是不够的。请确保您选择了合适的 JDK 主页目录或下载并安装最新的JDK:链接“
I clicked the download link for windows x64 and it never loads and eventually says there's no connection. I tried the x86 as well.
我点击了 windows x64 的下载链接,但它永远不会加载,最终说没有连接。我也试过 x86。
In this SO question How do I find where JDK is installed on my windows machine?
在这个问题中如何找到 JDK 安装在我的 Windows 机器上的位置?
Answer:For windows, in the command prompt:
答:对于 Windows,在命令提示符下:
c:\> for %i in (java.exe) do @echo. %~$PATH:i
And so I did that and got the path "C:\ProgramData\Oracle\Java\javapath\java.exe"
所以我这样做并得到了路径“C:\ProgramData\Oracle\Java\javapath\java.exe”
When I try linking via Unity > External tools > JDKit doesn't find any files.
当我尝试通过Unity > External tools > JDK 进行链接时,它找不到任何文件。
I'm a bit clueless now.
我现在有点不知所措。
回答by
@RealAnyOne, you have installed Java with JRE only installation i.e., without out a JDK that's what you see only one folder and this is why it also showing version in the command line since it won't check for JDK. JRE is Java Runtime Environment, JDK is Java Development Kit which contains many essential libraries. So Ideally there should be two folders JRE and JDK. This is the reason you are getting this issue with Unity.
@RealAnyOne,您只安装了 JRE,即安装了 Java,即没有 JDK,您只能看到一个文件夹,这就是为什么它还在命令行中显示版本,因为它不会检查 JDK。JRE 是 Java 运行时环境,JDK 是 Java 开发工具包,其中包含许多基本库。所以理想情况下应该有两个文件夹 JRE 和 JDK。这就是您在 Unity 中遇到此问题的原因。
To Fix::
修理::
Uninstall old Java 8
Download Java 8 from the oracle website http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Install it. Now you should have two folders. Then point your Unity to it.
卸载旧的 Java 8
从 oracle 网站下载 Java 8 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
安装它。现在你应该有两个文件夹。然后将您的 Unity 指向它。