bubblewrap icon indicating copy to clipboard operation
bubblewrap copied to clipboard

Find JDK automatically in common places

Open christianhujer opened this issue 2 years ago • 1 comments

$ which javac
/home/christian.hujer/.sdkman/candidates/java/current/bin/javac
$ javac --version
javac 19.0.2
$ bubblewrap init --manifest https://chatncharge.nelkinda.com/manifest.json
,-----.        ,--.  ,--.  ,--.
|  |) /_,--.,--|  |-.|  |-.|  |,---.,--.   ,--,--.--.,--,--.,---.
|  .-.  |  ||  | .-. | .-. |  | .-. |  |.'.|  |  .--' ,-.  | .-. |
|  '--' '  ''  | `-' | `-' |  \   --|   .'.   |  |  \ '-'  | '-' '
`------' `----' `---' `---'`--'`----'--'   '--`--'   `--`--|  |-'
                                                           `--'    
? Do you want Bubblewrap to install JDK?
  (Enter "No" to use your JDK installation) No
? Path to your existing JDK: 

Bubblewrap should offer to pick up what's in PATH. Supporting SDKMAN! would be best, but at least pickup what's on PATH.

Is your feature request related to a problem? Please describe. It's frustrating that a tool like bubblewrap can't pickup where my JDK is, especially when my JDKs are in standard locations like ~/.sdkman/candidates/java/ and /usr/lib/jvm/.

Describe the solution you'd like I would like Bubblewrap to try to pick up Java by itself, in this sequence:

  1. Try to find java from $PATH.
  2. Try to find a suitable version from SDKMAN! using $SDKMAN_CANDIDATES_DIR if defined, otherwise $SDKMAN_DIR/candidates.
  3. Try to find a suitable version from /usr/lib/jvm. If a version is found, ask the user if that version should be used. If yes, use it, if no, keep on looking. If no version found, give up and ask the user.

christianhujer avatar May 09 '23 17:05 christianhujer

This should be possible, but we have to guarantee suggesting a compatible JDK (this method can help)

andreban avatar May 10 '23 09:05 andreban