`exec java` resolving to the wrong path
alpineyahoo opened this issue ยท 4 comments
๐ Bug report ๐
Alda doesn't work properly.
Description
I installed alda from homebrew and tried to play an example code on alda official webpage, but failed.
Steps to Reproduce
- I installed/updated alda from homebrew.
alda
andalda-player
executables are in/usr/local/bin
directory as expected.- I ran
alda play -c "(tempo! 160) trumpet: (quant 60) f12 b- > d f6 d12 f1"
and the output is below:
Starting player processes...
Aug 29 16:23:07 WRN alda.io/client/cmd/root.go:80 > Failed to fill player pool. error="exit status 126"
It looks like Alda is having trouble starting player processes in the
background. This could happen for a number of reasons.
To troubleshoot:
โข Run alda doctor and see if any of the health checks fail.
โข Run alda ps to see the state of any currently running player
processes.
โข Look for error messages in:
/Users/*******/Library/Caches/alda/logs/alda-player.log
โข Try running a player process in the foreground:
alda-player -v run -p 27278
โข Try to make it play something:
alda -v2 play -p 27278 -c "piano: c12 e g > c4"
- I also ran
alda doctor
andalda ps
. The outputs are below:
$ alda doctor
OK Parse source code
OK Generate score model
OK Ensure that there are no stale player processes
OK Find an open port
OK Send and receive OSC messages
ERR Locate alda-player executable on PATH
---
Oops! Something went wrong:
exit status 126
This might be a bug. For help, consider filing an issue at:
https://github.com/alda-lang/alda/issues/new/choose
Or come chat with us on Slack:
https://slack.alda.io
$ alda ps
id port state expiry type
alda-player.log
doesn't exist at this time.
Expected Behavior
Actual Behavior
Environment
Operating system and version:
I am using macOS.
$ sw_vers
ProductName: macOS
ProductVersion: 14.0
BuildVersion: 23A5286i
Alda version:
$ alda version
alda 2.2.6
Aug 29 16:54:32 WRN alda.io/client/cmd/root.go:80 > Failed to fill player pool. error="exit status 126"
$ alda-player info
/usr/local/bin/alda-player: line 3: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/java: No such file or directory
/usr/local/bin/alda-player: line 3: exec: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/java: cannot execute: No such file or directory
Health check:
$ alda doctor
Logs:
I couldn't find any logs.
java -version
output here:
openjdk version "20.0.2" 2023-07-18
OpenJDK Runtime Environment Temurin-20.0.2+9 (build 20.0.2+9)
OpenJDK 64-Bit Server VM Temurin-20.0.2+9 (build 20.0.2+9, mixed mode, sharing)
I have temurin
installed. (I mean, I did brew install temurin
.)
Hi!
I double-checked the build script for alda-player
, and it's literally putting exec java
into the executable. I think the issue that you're running into is that exec
is choosing the wrong location for the java
executable. It's attempting to find it in a Java 17 specific path, which you appear not to have on your system.
You do have Java 20 installed, so I think what you need to do to resolve this is figure out how to get exec
to resolve java
to the correct path where your Java 20 java
executable is located.
I'm not a Mac user, so I'm not really sure what the best recommended way of doing that is on a Mac. I did find a couple of StackOverflow discussions that might be helpful:
- https://stackoverflow.com/questions/26252591/mac-os-x-and-multiple-java-versions
- https://superuser.com/questions/916317/command-line-terminal-in-mac-os-x-shows-wrong-version-of-java
I saw some people recommending jenv
, and I can vouch for that approach. I've been using jenv
for a long time to manage having multiple versions of Java installed, and it's always worked well for me.
This simple approach looks promising too.
Thanks, @daveyarwood. I'll take a look at java version managers to solve this. I'll close this issue.