Hi all,
Im tearing my hair out with this one. One day Im happily producing android builds, the next Im getting an error asking me to point to a valid JDK directory. I’ve wasted half a night trying to get it working again to no avail.
I’ve tried adding the jdk path to the environment variable,restarted the pc etc,updated the jdk and nothing works.
Can anyone please help???
EDIT: Im running 64bit. I tried both 64bit and x86 jdks. No luck
You haven’t provided many details about your configuration so I’ll try to cover all the bases here.
The path that will “look like” a valid JDK installation is as follows:
jdk_1.8 ← Point to this folder
| bin
| javaw.exe
| javac.exe
| include
| jre
| bin
| javaw.exe
| lib
| lib
When you find where to input the path it should be the top level jdk folder (not bin or jre).
There are several levels of “resolution” that are used to find the java installation, going from most specific to least specific (which is the search order) they are typically:
- Application
- User
- System
Typically an application will allow you to specify the path directly in a settings menu, however some require you to specify the path before the application is started, either via configuration or system level path (you didn’t specify what program you are using).
User and System will both roll up under “Environment” variables for windows (again, you didn’t specify what operating system you are using). User environment variables will typically override what is set for the system variables of the same name. Typically, the Java installation will set the System level environment variables.
Currently I have the following vars set which seem to work for most apps:
- JAVA_HOME C:\Java\jdk_1.8.0_102\jre
- JDK_HOME C:\Java\jdk_1.8.0_102
- JRE_HOME C:\Java\jdk_1.8.0_102\jre
-PATH %JAVA_HOME%;%JAVA_HOME%\bin;%JDK_HOME%;%JDK_HOME%\bin etc etc
Having the path include JAVA_HOME and JDK_HOME may be important for some applications to work correctly (note that I include both JAVA_HOME and JAVA_HOME\bin so I can access both folders directly). My JAVA_HOME does indeed point to the JRE, but I suspect pointing to the JDK would also work. Sometimes you need to swap the paths around before they work correctly for your target application.
You may need to restart after updating your environment before it fully takes effect. If you are installing a new version of Java, I would recommend you try to ensure no older unwanted versions are still installed. Make sure the version you do have installed is compatible with the application you are using. If you have auto-update enabled, Java may have updated behind the scenes without you knowing it.