简体   繁体   English

无法下载JDK 8

[英]Can't download JDK 8

I'm trying to setup Unity to build for Android. 我正在尝试设置Unity以为Android构建。 But I can't get the Java Development Kit. 但是我找不到Java开发工具包。 Can't download it and can't find it either. 无法下载,也找不到。

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. 要确保已安装JDK,只需执行以下操作:在弹出窗口中按Win + R键入“ cmd”,然后按确定按钮。 in the console which has opened, type javac -version and press enter. 在打开的控制台中,键入javac -version并按Enter。 You should see as an output : javac 1.8.0_XX If so SDK is installed . 您应该看到一个输出: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 > JDK and 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. 我单击了Windows x64的下载链接,但该链接从未加载,并最终说没有连接。 I tried the x86 as well. 我也尝试过x86。

In this SO question How do I find where JDK is installed on my windows machine? 在这个SO问题中, 如何找到Windows计算机上JDK的安装位置?

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 > JDK it doesn't find any files. 当我尝试通过Unity>外部工具> JDK进行链接时,找不到任何文件。

I'm a bit clueless now. 我现在有点笨了。

@RealAnyOne, you have installed Java with JRE only installation ie, 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. @RealAnyOne,您安装的Java仅具有JRE安装,即没有JDK,您只能看到一个文件夹,这就是为什么它还在命令行中显示版本的原因,因为它不会检查JDK。 JRE is Java Runtime Environment, JDK is Java Development Kit which contains many essential libraries. JRE是Java运行时环境,JDK是Java Development Kit,其中包含许多基本库。 So Ideally there should be two folders JRE and JDK. 因此,理想情况下应该有两个文件夹JRE和JDK。 This is the reason you are getting this issue with Unity. 这就是您在Unity中遇到此问题的原因。

To Fix:: 修理::

  1. Uninstall old Java 8 卸载旧的Java 8

  2. Download Java 8 from the oracle website http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 从Oracle网站http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html下载Java 8

  3. Install it. 安装它。 Now you should have two folders. 现在您应该有两个文件夹。 Then point your Unity to it. 然后将您的Unity指向它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM