alda: Alda CLI does not always recognize AdoptOpenJDK installation

Moved from alda-lang/alda-core#74.

Not sure if this belongs here or in alda-client-java. I recently replaced my Java installation with an AdoptOpenJDK installation.

PS C:\Users\elyis> java -version
openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.4+11)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.4+11, mixed mode)

However, alda simply does not detect it:

PS C:\Users\elyis> alda
This application requires a Java Runtime Environment 1.7.0

Any idea what’s going on?

I have since found out that the alda CLI does recognize AdoptOpenJDK 8, but only if the option to add the required registry keys is enabled in the AdoptOpenJDK installer. AdoptOpenJDK 11 installations do not seem to be recognized at all.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (13 by maintainers)

Most upvoted comments

Your guess is as good as mine!

I’m not 100% that there’s something we can do about this - it might be something that needs to be fixed in AdoptOpenJDK 11.

In case it’s helpful, I can address this thought you had in https://github.com/alda-lang/alda-core/issues/74:

I’m not sure how the alda CLI is checking for a Java installation.

The answer to this question is simple in the case of Linux/Unix. alda is essentially a shell script with a jar file embedded inside of it, and it invokes java, so that will be whatever version of java you have on your PATH.

For Windows, it’s a bit different because we use launch4j to turn our jar file into alda.exe. I see here that others have reported similar issues re: launch4j and AdoptOpenJDK 11. That thread links to this other thread where it looks like we can specify %JAVA_HOME% as the JRE path in the launch4j config when we build alda.exe. I think that means that when you run alda.exe, it will check %JAVA_HOME%, which I think should work at least for AdoptOpenJDK. I’m a little worried that might break other Java distributions, though, if they don’t set %JAVA_HOME%

I’ll have to think about this. I’m not too familiar with the Windows Java ecosystem, so if anybody has any pointers about how to turn a jar file into an exe file that will work regardless of Java distribution, that would be very helpful!