Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discovery / Search Feature #362

Open
ebresie opened this issue May 29, 2022 · 2 comments
Open

Discovery / Search Feature #362

ebresie opened this issue May 29, 2022 · 2 comments

Comments

@ebresie
Copy link

ebresie commented May 29, 2022

Presently, jenv requires to manually "add" each jdk path on the system.

It would be nice to have a jenv discover feature which would search the system (maybe can specify a specific path to reduce the search), to discover available JDKs present.

So if there is a collection of different java versions in a given folder, find and add each of the JDK folders. Maybe with each find could have an "autogenerated" id/label and/or path shown and ask if would like to add or not for use in an interactive mode.

May have to take care also to not add the same version multiple times so check if given one exists already from the list of know/previously added jdks.


This is based on a similar feature request on Jenv for windows. See FelixSelter/JEnv-for-Windows#32

@marquiswang
Copy link
Contributor

Agreed that this would be very nice. Would just need a list of paths of known locations for JDKs for various OSes.

For Macs:

/Library/Java/JavaVirtualMachines/*/Contents/Home
/usr/local/Cellar/openjdk*/
/opt/homebrew/Cellar/openjdk*/

Linux (Redhat/Debian distros anyways):

/usr/lib/jvm/*

Do you know of any other paths to look in?

@andrewflbarnes
Copy link
Contributor

andrewflbarnes commented Mar 22, 2024

Had a quick look at autoscan in windows jenv - would definitely be a nice feature to have, especially for new users. This there would probably be a couple of variants.

  • jenv autoscan - search well known locations
  • jenv autoscan <folder> - search the given folder
  • jenv autoscan --all - search the whole filesystem

Might also be useful to have options like

  • -y - auto add any versions found if not already linked

Would need to determine/effect the below

  • order of precedence of locations
  • do we follow symlinks as part of the search to other folders?
  • probably shouldn't scan nfs? maybe there should be an option like --allow-nfs/--allow-all
  • probably shouldn't scan external? maybe there should be an option like --allow-external/--allow-all
  • what locations do we always avoid (/proc, /dev, etc.)?

As a first cut can probably just implement the well known locations search and explicit folder search and prevent the user from supplying /, then not worry about symlinks, nfs, etc.

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

No branches or pull requests

3 participants