theapache64 / stackzy

💻 A cross-platform desktop application to identify libraries used inside an android application. Made possible by Compose Desktop ⚡
Apache License 2.0
1.04k stars 56 forks source link

Mac OS JAVA_HOME env variable not found error #82

Open AddictArts opened 2 years ago

AddictArts commented 2 years ago

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

theapache64 commented 2 years ago

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

SteinerOk commented 2 years ago

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

image

rickclephas commented 2 years ago

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
theapache64 commented 2 years ago

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 commented 2 years ago

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

SteinerOk commented 2 years ago

@theapache64, you are right :( image

SteinerOk commented 2 years ago

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

rickclephas commented 2 years ago

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 👍🏻 .

theapache64 commented 2 years ago

@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

rickclephas commented 2 years ago

@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)
theapache64 commented 2 years ago

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