# ERROR: JAVA\_HOME is set to an invalid directory

**URL:** <https://forums.unrealengine.com/t/error-java-home-is-set-to-an-invalid-directory/780223>\
**Category:** Mobile\
**Tags:** unreal-engine, Android, question\
**Created:** [February 28, 2023, 5:22am UTC](https://forums.unrealengine.com/t/error-java-home-is-set-to-an-invalid-directory/780223 "2023-02-28T05:22:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![VektorGaming](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vektorgaming/32/88719_2.png) [@VektorGaming](https://forums.unrealengine.com/u/VektorGaming)\
**Post date:** [February 28, 2023, 5:22am UTC](https://forums.unrealengine.com/t/error-java-home-is-set-to-an-invalid-directory/780223/1 "2023-02-28T05:22:27Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/3/a/83a2c875f9c3ece4d5f4e3c7319857ae68e6e051.png)  
Hi all. I decided to update my mobile project to 5.1 and after the update it needed a different target sdc, I installed it and changed. However, after that, an error with java began to fly out, claiming an error between the environment variable and the installed java location. I already tried to change the Java installation location in the project settings, but another error pops up and I’m sure that I’m correcting the first one incorrectly. Tell me what am I doing wrong

---

<div class="post-metadata">

**Author:** ![hyperdr1ve](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@hyperdr1ve](https://forums.unrealengine.com/u/hyperdr1ve)\
**Post date:** [March 6, 2023, 11:16pm UTC](https://forums.unrealengine.com/t/error-java-home-is-set-to-an-invalid-directory/780223/2 "2023-03-06T23:16:34Z")

</div>

I think the issue is that your `JAVA_HOME` should point to a jdk but yours is pointing to the jre. Java Development Kit (jdk) is for making apps, Java Runtime Environment (jre) is for running java apps.

The default install location for the jdk is in program files, for example:  
`C:\Program Files\Java\jdk-19`

---

<div class="post-metadata">

**Author:** ![VektorGaming](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vektorgaming/32/88719_2.png) [@VektorGaming](https://forums.unrealengine.com/u/VektorGaming)\
**Post date:** [March 17, 2023, 5:48am UTC](https://forums.unrealengine.com/t/error-java-home-is-set-to-an-invalid-directory/780223/3 "2023-03-17T05:48:21Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/7/a/c7a6472896b368e5e15e053c521bab6c7975d97e.png)  
I already changed the environment variable settings to match the UE5 setting - this leads to the error indicated in the picture. I found a small thread on reddit where a person had the same problem, but my level of English does not allow me to understand exactly what he did. He writes about creating a new keystore, but it didn’t help me, maybe he means something else. Here is the quote:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/1/6/a1628ad4706cfe45aecd2749daffee8795766a5d.png)

---

<div class="post-metadata">

**Author:** ![VektorGaming](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/vektorgaming/32/88719_2.png) [@VektorGaming](https://forums.unrealengine.com/u/VektorGaming)\
**Post date:** [March 17, 2023, 5:55am UTC](https://forums.unrealengine.com/t/error-java-home-is-set-to-an-invalid-directory/780223/4 "2023-03-17T05:55:36Z")

</div>

> [@hyperdr1ve](#):
>
> C:\Program Files\Java\jdk-19

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/8/3/383fe247c35d2efb9d898290c7b2e275b0b92ccc.png)  
Maybe the problem is in the outdated jdk?

---

<div class="post-metadata">

**Author:** ![vertige144](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vertige144](https://forums.unrealengine.com/u/vertige144)\
**Post date:** [March 20, 2023, 3:14pm UTC](https://forums.unrealengine.com/t/error-java-home-is-set-to-an-invalid-directory/780223/5 "2023-03-20T15:14:53Z")

</div>

1. **Windows 7** – Right click **My Computer** and select **Properties** \> **Advanced**  
2._Windows 8_\* – Go to **Control Panel** \> **System** \> **Advanced System Settings**  
**Windows 10** – Search for **Environment Variables** then select **Edit the system environment variables**
2. Click the **Environment Variables** button.
3. Under **System Variables** , click **New**.
4. In the **Variable Name** field, enter either:

- `JAVA_HOME` if you installed the JDK (Java Development Kit)  
or
- `JRE_HOME` if you installed the JRE (Java Runtime Environment)

1. In the **Variable Value** field, enter your JDK or JRE installation path.  
 ![java_home](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/9/7/e973396e0ab333c818bd95f39248e9b3bf002912.png)

---

<div class="post-metadata">

**Author:** ![Ashkor3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ashkor3](https://forums.unrealengine.com/u/Ashkor3)\
**Post date:** [April 17, 2024, 2:15pm UTC](https://forums.unrealengine.com/t/error-java-home-is-set-to-an-invalid-directory/780223/6 "2024-04-17T14:15:37Z")

</div>

worked. Thanks a lot

---

<div class="post-metadata">

**Author:** ![tankthunder](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tankthunder/32/726697_2.png) [@tankthunder](https://forums.unrealengine.com/u/tankthunder)\
**Post date:** [August 28, 2024, 3:31pm UTC](https://forums.unrealengine.com/t/error-java-home-is-set-to-an-invalid-directory/780223/7 "2024-08-28T15:31:03Z")

</div>

Still the best answer and working!
