I’m trying to export to Android from Flax on Linux, but every attempt fails with the following error:
[Error] Missing or invalid JAVA_HOME env variable.
[Error] Game building failed!
The strange part is that my Java installation appears to be completely valid.
My setup
Flax 1.12 (through Seed.Appimage)
Fedora 44
.NET 8 SDK installed
Android SDK installed
Oracle JDK 21 (also tried JDK 17 previously)
What I’ve tried
Verified that JAVA_HOME is correctly set.
Verified that ANDROID_HOME is correctly set.
Verified that DOTNET_ROOT is correctly set.
Confirmed java and javac work correctly.
Confirmed JAVA_HOME/bin contains java, javac, keytool, jarsigner, and the rest of the JDK tools.
Added the environment variables permanently to my .bashrc.
Launched Seed from a terminal after sourcing my environment.
Explicitly launched Seed using env while setting JAVA_HOME, ANDROID_HOME, DOTNET_ROOT, and PATH.
Linux exports work perfectly; only Android exports fail.
At first I assumed I had broken something on Arch Linux after a system update, so I even moved to a fresh Fedora installation thinking a more stable distribution would solve the problem. Unfortunately, the exact same error still occurs.
At this point I’m starting to wonder if this is a Linux-specific issue with Android exporting or if Flax is validating JAVA_HOME incorrectly.
Has anyone managed to export an Android project from Linux recently? If so, what JDK version and Android SDK setup are you using?
Hey, it’s been a while since last time I tested Android export from Linux as Windows is the most reliable but you you a good research here. Env var JAVA_HOME is tested by Game Cooker if it exists and the directory that points to exists. Does that folder is a link or normal directory?
Ah I know what’s the issue. We don’t do recursive env var resolution so we check for folder named $HOME/jdk21. I think you need to put your $HOMEdirectory into java env var to have it working.
So unless I’m missing something, Platform::GetEnvironmentVariables() should be getting /home/celumusa/jdk21, and FileSystem::DirectoryExists(javaHome) should return true.
Is there another place where JAVA_HOME is being read or modified before this check?
What I showed above with env is just one of the ways i tried exposing the path.
I will just dual boot windows just to export the game but the error persist for me no matter the distro since I primary use Linux.
I wasn’t able to recreate this on my machine, but I also don’t use the Seed launcher
Looking at the code snippet mafiesto4 posted, that error should be printing the JAVA_HOME directory it sees:
LOG(Error, "Missing or invalid JAVA_HOME env variable. {0}", javaHome);
In your screenshot there’s nothing after the period, which means the string is empty or there was an error, so Flax isn’t finding the variable at all
My guess is that however you’re launching Flax (through Seed, or some other way) isn’t pulling in your .bashrc/.zshrc/whatever shell config you’re using. GUI launchers might not source those, so the variable never makes it into the editor process even though it’s set fine in your terminal
I’d recommend launching the editor binary directly from your terminal, not through Seed, and seeing if the issue persists
Or if you’re launcher Seed through your program picker than I would also try by running Seed directly from you terminal as well as your program picker would also not grab you shell config when launcher Seed or any other program