0

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.

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.

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"

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.

In this SO question How do I find where JDK is installed on my windows machine?

Answer: For windows, in the command prompt:

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"

When I try linking via Unity > External tools > JDK it doesn't find any files.

I'm a bit clueless now.

Jaymin
  • 2,879
  • 3
  • 19
  • 35
RealAnyOne
  • 125
  • 3
  • 3
  • 17
  • Can you tell me What folders are under your C:\Program Files\Java ? –  Jan 01 '18 at 12:58
  • Only one: jre1.8.0_151. So probably I don't have the JDK, but downloading isn't working either. I read that in some countries Java or JDK isn't available, but my country is listed in this link: http://www.oracle.com/technetwork/java/javase/javase7locales-334809.html – RealAnyOne Jan 01 '18 at 13:00
  • I just tried and able to download 8u151 version. This might be issue with your internet. Make sure some proxy or firewall is not blocking it. –  Jan 01 '18 at 13:10
  • If oracle links are not working for you, then u can try other websites like filehippo https://filehippo.com/download_java_development_kit/ –  Jan 01 '18 at 13:13
  • Try and let me know if my answer helped you fix the issue? –  Jan 01 '18 at 13:16
  • Yes. The download doesn't lead anywhere but I think it does it "silently"? After uninstalling Java I looked for it to see if it was removed, found JavaSetup8u151.exe so I ran that, and just installed Java 8 again. Still all I see is that jre folder. – RealAnyOne Jan 01 '18 at 13:20
  • Where did u found JavaSetup8u151.exe? In your own computer? –  Jan 01 '18 at 13:22
  • On my pc yes, in the "search". The download worked from filehippo, I'll see if it works now. – RealAnyOne Jan 01 '18 at 13:24
  • I think the one on your PC is JRE only. Try the one from File hippo. –  Jan 01 '18 at 13:25

1 Answers1

3

@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.

To Fix::

  1. Uninstall old Java 8

  2. Download Java 8 from the oracle website http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

  3. Install it. Now you should have two folders. Then point your Unity to it.

  • The download from filehippo worked, thank you very much. Oracle links aren't loading for me. – RealAnyOne Jan 01 '18 at 14:01
  • 1
    I've downloaded Java many times, but this is the first time it is redirecting to the Oracle Sign In page. Trying to download Java 8, did it reach EOL? It says, "The Oracle JDK License has changed for releases starting April 16, 2019.", am a little confused. Any help? – Aakash Basu Jun 20 '19 at 11:59