stackzy icon indicating copy to clipboard operation
stackzy copied to clipboard

Mac OS JAVA_HOME env variable not found error

Open AddictArts opened this issue 2 years ago • 11 comments

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

AddictArts avatar Dec 08 '21 00:12 AddictArts

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

theapache64 avatar Jan 07 '22 18:01 theapache64

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

image

SteinerOk avatar Jan 08 '22 14:01 SteinerOk

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

rickclephas avatar Jan 08 '22 15:01 rickclephas

I think you've JDK installed, but JAVA_HOME is not set. Maybe I shouldn't rely on JAVA_HOME at all. https://github.com/theapache64/stackzy/blob/49811525fa0ee7d737774784ec0015878ba06721/src/main/kotlin/com/theapache64/stackzy/ui/feature/splash/SplashViewModel.kt#L68-L75

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

theapache64 avatar Jan 08 '22 18:01 theapache64

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

theapache64 avatar Jan 08 '22 18:01 theapache64

@theapache64, you are right :( image

SteinerOk avatar Jan 08 '22 18:01 SteinerOk

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

SteinerOk avatar Jan 08 '22 18:01 SteinerOk

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 avatar Jan 08 '22 21:01 rickclephas

@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 avatar Jan 11 '22 04:01 theapache64

@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 avatar Jan 11 '22 11:01 rickclephas

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

theapache64 avatar Jan 11 '22 12:01 theapache64