Stan Kenway
Stan Kenway

Reputation: 95

JAVA_HOME is set to an invalid directory but it is set to the right directory

There is a lot of this here. I know that. Each one of these problems ends up being somebody setting the sys variable with a ; or /bin

Here is my error:

C:\Users\vakke\DarkBotDev3\DarkBotDev3>gradle build

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk_1.8.0_141

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

Upvotes: 1

Views: 6276

Answers (2)

Warren
Warren

Reputation: 1

User Chinmoy gave a clue in another thread on this JAVA_HOME problem. Windows 10 tacks on a semi-colon to the path to the JDK. When you go back to the Environment Variables window you can remove the semi-colon by clicking on the edit button. This fixed the problem of

The JAVA_HOME environment variable is not defined correctly This environment variable is needed to run this program NB: JAVA_HOME should point to a JDK not a JRE.

Upvotes: 0

Grokku
Grokku

Reputation: 424

I'd say you need quotes on that path or to escape that space, as it is probably understanding that the part before the space is the first parameter and the rest is an invalid parameter it is ignoring. Can you confirm it is understanding the space?

Upvotes: 2

Related Questions