theapache64/stackzy

Mac OS JAVA_HOME env variable not found error

AddictArts opened this issue · 11 comments

Build the app with JDK15, run it and get the error message.

Can you enter the command java -version in your terminal and paste the output here?

I try to launch stackzy on MacOS 12.1, but receive this error:

image

I am not quite sure yet where the JAVA_HOME should be set for this to work automatically but you can open the app with the following command:

JAVA_HOME=$(/usr/libexec/java_home -v 15) open /path/to/Stackzy.app

I think you've JDK installed, but JAVA_HOME is not set. Maybe I shouldn't rely on JAVA_HOME at all.

private fun checkJdk(onExist: () -> Unit) {
val isJdkExists = System.getenv("JAVA_HOME") != null
if (isJdkExists) {
onExist()
} else {
_syncFailedMsg.value = "Ohh no! It looks like you don't have JDK installed 😥"
}
}

@SteinerOk Can you enter echo $JAVA_HOME in your terminal?

@SteinerOk @AddictArts Can you guys take a pull from master and try run ./gradlew run now? I've made some changes

@theapache64, you are right :(
image

@theapache64 I launched via JAVA_HOME=$(/usr/libexec/java_home -v 15) open /path/to/Stackzy.app, but got new error:
image

I think you've JDK installed, but JAVA_HOME is not set. Maybe I shouldn't rely on JAVA_HOME at all.

Even with JAVA_HOME set in ~/.zshenv, ~/.zshrc or ~/.zprofile I got the same error.
Maybe it should be set somewhere else for it to affect applications as well?

Can you guys take a pull from master and try run ./gradlew run now? I've made some changes

I am seeing #80 when running ./gradlew run.
Actually ./gradlew run fails with:

Execution failed for task ':run'.
> Process 'command '/Library/Java/JavaVirtualMachines/zulu-15.jdk/Contents/Home/bin/java'' finished with non-zero exit value 134

However ./gradlew createDistributable does create the app which no longer shows the error message 👍🏻 .

@rickclephas Interesting.
I've created an uberJar for macOS. Can you guys download this jar and run java -jar /path/to/jar ?

@rickclephas @SteinerOk @AddictArts

@theapache64 I am using macOS 12.1 (MBP M1 Pro) with JDK 15 (Azul) and get the following error with that jar:

Caused by: org.jetbrains.skiko.LibraryLoadException: Cannot find libskiko-macos-arm64.dylib.sha256, proper native dependency missing.
	at org.jetbrains.skiko.Library.load(Library.kt:72)
	at org.jetbrains.skia.impl.Library$Companion.staticLoad(Library.jvm.kt:12)
	at org.jetbrains.skia.Image.<clinit>(Image.kt:144)

@rickclephas Ohh you're using the M1. That needs a separate binary I guess.