Skip to content

Add a JDK discovery mechanism #16

@felipebz

Description

@felipebz

Currently, javm only works with versions it explicitly installs or linked with javm link. Adding support for JDK discovery would allow users to use existing JDKs on their system (e.g. from SDKMAN, Jabba, or manually installed ones), improving compatibility, reducing duplication, and easing migration.

The discovery system should search for candidate JDKs from multiple sources and collect their metadata (version, vendor, architecture, etc). Some locations that can be used by this discovery mechanism:

  • Common locations: /usr/lib/jvm (on Linux), /Library/Java/JavaVirtualMachines (on macOS), C:\Program Files\Java (on Windows), JAVA_HOME env var
  • Other version managers: Detect and scan paths used by Jabba, SDKMAN!, and Asdf-vm
  • IntelliJ JDKs
  • Maven toolchains
  • Gradle auto-provisioned toolchains

Idea of detection process

For each candidate path:

  • Ensure it contains a working bin/java
  • Run java -version or parse the release file
  • Parse metadata: version, vendor, implementation type (JDK/JRE), architecture

Cache results to avoid repeated I/O or process spawns

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions