XR Export JDK path

Godot Version

Godot Version 4.3

Question

Hi all,

just a small question: i am a Java-Developer and have several JDKs installed, the latest LTS version being the default in the path.

When exporting i get the error message:

Invalid java version 21. Version 17 is the required java version…

I can manually set the JDK to use in the gradle.properties file.

But is this the preferred way to configure it? Or is there some config parameter in the editor i am missing? :slight_smile:

If I’m not mistaken you can use the JAVA_HOME environment variable to point to the correct JDK.

JAVA_HOME is pointing to a JDK in version 21 on my system, because i need this for Java development. :slight_smile:

I was hoping for some project setting like shown here:

Android Export: A valid Java SDK path is required in Editor Setting

but i can’t find it in my project settings. :man_shrugging:

I think that path is only used when Godot calls things in the JAVA SDK direction.
Because for XR exports we do a full gradlew build, it piggy backs on the environment settings I think. I wonder if this is something that can be improved because you’ll not be the only one that has multiple versions of Java in play.

It would be great if there were an optional editor setting for this. This could than be used as parameter for the gradle build if set, like e.g.:

-Dorg.gradle.java.home=/path/to/jdk/17

The JAVA_HOME JDK(21) would be used to start gradle, the configured JDK(17) would be used for the build itself. Thus i wouldn’t have to modify files in the android subfolder, which i would prefer to keep untouched.

Maybe this is an option for a future release. :slight_smile:

@arassec That setting is available in the editor settings, not the project settings and was specifically added to address this type of issue.
You can just point to your jdk17 install and Godot will do the rest.

My bad! I didn’t look carefully enough and searched the project settings. :man_facepalming:

The path in the editor settings works as expected. Thanks for the help!

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.