jbang icon indicating copy to clipboard operation
jbang copied to clipboard

Use Disco API to install different jdks distributions on demand

Open gochev opened this issue 2 years ago • 3 comments

I would like to be able to use any Java VM and version combinations when using jbang

I would like to be able to specify and install ANY, any Java version and jdk if wanted when using jbang or override existing. So graalvm or Azul(Zulu) or openJ9 and etc This functionality partially exists and some are already available but not that many. You can use the Disco API to find the proper URL for download of every distribution.

Describe the solution you'd like Use https://github.com/foojayio/discoapi so I can pass version 11.0.9.1 for mac or something and get this installed if I don't have exactly that already. Also even if I have something but want to make an example using graalVM or hotspot vs j9 I would love to be able to make the compare between them using jbang, fast install and replace run and again.

Additional context Disco API will provide the urls for every open source jdk destribution https://github.com/foojayio/discoapi.

Also for each version like java 14 for example you can get the list of all distributions that support java 14 and so you can get that. This is super common I have to super often install different jdks versions and vendor for testing purposes and instead of using a second tool like discocli or sdkman and it will be great to be able to do all using only jbang, maybe not with all options but just the ones that make sense.

gochev avatar May 26 '22 08:05 gochev

it looks it's already done just not documented and with partial possibilities

gochev avatar May 26 '22 08:05 gochev

Yes, you can actually install the distro of your choice by setting the JBANG_JDK_VENDOR environment variable to any of the values supported by Foojay's Disco API.

This is actually documented here: https://www.jbang.dev/documentation/guide/latest/usage.html but it's not something we draw a lot of attention to because it's very specific to the API. This way of doing things also only allows a single install for each major Java version. Which is quite a limitation if you want to be able to test several different distros, but we're still discussing if we want to change that or not because it would add quite a lot of complexity.

quintesse avatar May 26 '22 09:05 quintesse

This comes up once in a while. See https://github.com/jbangdev/jbang/issues/316

I'm not against making it easier to do more via disco BUT it must not make it so the shell and power shell code gets complicated not that --java or //JAVA stops working.

maxandersen avatar May 26 '22 19:05 maxandersen