Hexfate
Hexfate

Reputation: 1

Gradle says JAVA_HOME is the wrong version of Java even though it is correct while Im generating sources

I was trying to make a mod using Fabric for Java Minecraft and when I used ./gradlew genSources to get access to the default code of Minecraft it said

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Common Files\Oracle\Java\javapath\java.exe 
 
Please set the JAVA_HOME variable in your environment to match the 
location of your Java installation.

Im on windows 11 and am using Intelij Idea Community Edition

I ran where java to find where java is and double checked it and it came up the same both times; I also ran java -version and it showed the same version and as also oracle

I even double checked the JAVA_HOME variable in settings and ran echo %JAVA_HOME% and both came the exact same as gradle said.

Java version returned

java version "17.0.12" 2024-07-16 LTS
Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.12+8-LTS-286, mixed mode, sharing)

Where java returned

C:\Program Files\Common Files\Oracle\Java\javapath\java.exe

Java home is set to

C:\Program Files\Common Files\Oracle\Java\javapath\java.exe

Gradlew said it was set to

C:\Program Files\Common Files\Oracle\Java\javapath\java.exe

I have also checked and I have Java 17 Oracle OpenJDK 17.0.12 as my version on Intelij

Upvotes: 0

Views: 47

Answers (0)

Related Questions