Skip to content

Conversation

@quintesse
Copy link
Contributor

Fixes #2118

@quintesse quintesse force-pushed the devkitman_multi_jdks branch from 14d6edb to 9f510d6 Compare November 4, 2025 21:43
@maxandersen
Copy link
Collaborator

Interesting. How's it to be used/managed? Couldn't spot clearly the user impact if any?

@quintesse
Copy link
Contributor Author

The idea is that user impact at first is as close to zero as possible. Mainly to detect if the new system causes any backward compatibility issues.

For the user that is accustomed to installing jdks with jbang jdk install N nothing changes. That command keeps working as before, as does uninstall.

What does change is how jdks are stored on disk. Before you'd just have a bunch of numbered directories in ~/.jbang/cache/jdks, each one containing the jdk for that version, eg:

$ ls -F ~/.jbang/cache/jdks
11/  17/  21/  24/  25/  8/

But now with the new devkitman version you could see this:

$ ls -F ~/.jbang/cache/jdks
11/  17/  21/  24/  25/  26@  26-ea+21-temurin-jbang/  8/

As you can see I just installed a new version 26. And it gets stored in a directory with a full name (its id) and additionally a symlink was created with the name "26" that points to the actual directory.

This symlink serves two purposes: a) is serves as the "default" for that version, so if you have multiple version 26 jdks installed this symlink will point to your "preferred 26 version" and b) it maintains backward compatibility with older JBang versions that will only see the symlinks (older JBang versions ignore directories whose names are not integers).

I still have to make a couple of changes before explaining what else has changed. I will keep you posted in follow-up messages here.

@maxandersen
Copy link
Collaborator

gotcha.

and i assume its fine but just asking to know if some limits - on windows the symbolic linking also works ? no extra rights needed etc? in past we "survived" these even without extra rights as jsut one folder but i know some stuff improved here i just forget which :)

And wouldn't it be nicer if stored per vendor?, i.e. / ? or even to simplify have /installs//? just suggesting this to not mix-n-match too much in one folder directly.

whats the signficance of "-jbang" in the name?

@quintesse
Copy link
Contributor Author

on windows the symbolic linking also works ?

JBang already needs those to work. The default jdk that gets added to your path is a link (a Junction to be precise).

And wouldn't it be nicer if stored per vendor?, i.e. / ? or even to simplify have /installs//? just suggesting this to not mix-n-match too much in one folder directly.

I'm just somewhat following what I see others do. I also think it makes file/folder management slightly more complex to have more levels of directories. Given the fact that nobody should be looking directly at that folder and definitely not depend on its names and structure I feel it's okay to do it this way.

whats the signficance of "-jbang" in the name?

It's because the jdks are managed by the "jbang" provider. There's other providers that can create folders there, for example links to external jdks are handled by the "linked" provider and marked with "-linked".

@quintesse quintesse force-pushed the devkitman_multi_jdks branch 2 times, most recently from 6decb1a to db613f3 Compare November 20, 2025 15:04
@quintesse quintesse force-pushed the devkitman_multi_jdks branch from db613f3 to 3e306cf Compare December 12, 2025 17:43
@quintesse quintesse force-pushed the devkitman_multi_jdks branch 2 times, most recently from 3a2a8c8 to 8aeb565 Compare January 16, 2026 08:50
@quintesse quintesse marked this pull request as ready for review January 16, 2026 08:50
@quintesse quintesse requested a review from maxandersen January 16, 2026 08:52
@quintesse
Copy link
Contributor Author

@maxandersen this is now ready for review and devkitman 0.4.0 has been released so you don't need to build that to be able to test this PR.

Given the fact that this is a pretty major change it must be tested quite well (I already did of course, but I might be "blind" to certain issues). It must also be tested that older JBang versions keep working even when newer JDKs get installed by this new version.

Also, the workings and output of some of the jdk commands (eg jdk list) have changed somewhat, we might still want to polish that.

@quintesse
Copy link
Contributor Author

NB: currently releasing 0.4.1 because of a test failure that only appeared when running JBang's GH CI. (Seems GH uses legacy DOS paths in their environment variables, eg. JAVA_HOME=C:\PROGRA~1\Java\jdk11, which devkit handles okay enough except when trying to match it against a modern path)

@quintesse quintesse force-pushed the devkitman_multi_jdks branch 3 times, most recently from 0ac3adf to 056cbeb Compare January 16, 2026 20:05
Copy link
Collaborator

@maxandersen maxandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I ignore or honor the "do not merge" message ? :)

@quintesse quintesse marked this pull request as draft January 19, 2026 11:01
@quintesse
Copy link
Contributor Author

quintesse commented Jan 19, 2026

Sorry, this PR is ready for review but not ready to merge, I put it back to draft to make that clear.
Any changes I make are to make sure all tests pass and to add some new tests to make sure more things are covered.
But for review purposes (by you) the PR should be good.

@quintesse quintesse force-pushed the devkitman_multi_jdks branch 5 times, most recently from 25edf97 to f5e2801 Compare January 20, 2026 11:29
@quintesse quintesse marked this pull request as ready for review January 20, 2026 11:42
@quintesse
Copy link
Contributor Author

Ok, I marked this PR ready for review again because everything works now. The integration tests are failing because of the Alpine test not being able to download the Jdk 17 it needs, but that's unrelated to this PR.

Added a flag `--for-version` (or `-v`) to the `jdk default` command to
allow setting the default Jdk to use for a specific major version.
This is necessary now that we allow multiple Jdks of the same major
version to be installed simultaneously.
@quintesse quintesse force-pushed the devkitman_multi_jdks branch from f5e2801 to fc85039 Compare January 20, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make it possible to have multiple JDKs installed of the same version

2 participants