JEnv-for-Windows icon indicating copy to clipboard operation
JEnv-for-Windows copied to clipboard

Discovery / Search Feature

Open ebresie opened this issue 2 years ago • 2 comments

Not sure if this is needed in the jenv itself or just windows flavor but...

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.

ebresie avatar May 29 '22 14:05 ebresie

Also raised a similar issue in the jenv project. See https://github.com/jenv/jenv/issues/362

ebresie avatar May 29 '22 14:05 ebresie

That sounds like a great feature. Do you want to work on it?

FelixSelter avatar May 29 '22 15:05 FelixSelter

This is now implemented and will therefore be closed. View Readme for jenv autoscan

FelixSelter avatar Aug 19 '22 11:08 FelixSelter

This jenv autoscan is great! Would it be possible to accept some kind of -y to autoaccept the suggested name, so there is no need of user intervention?

rcsilva83 avatar Aug 30 '22 20:08 rcsilva83

Sure. This can be easily implemented. Out of curiousity, why would one not want to review the suggestions? Are you writing any script that uses JEnv?

Would you please open a new issue so this can be implemented. Also answer thefe if the -y flag is just for names or also to add the java version? Should they be separated i to two flags?

FelixSelter avatar Aug 30 '22 23:08 FelixSelter

Out of curiousity, why would one not want to review the suggestions? Are you writing any script that uses JEnv?

Yes, we are trying to automate some things for our developers.

Would you please open a new issue so this can be implemented. Also answer thefe if the -y flag is just for names or also to add the java version? Should they be separated i to two flags?

Sure. I'll open now!

rcsilva83 avatar Aug 31 '22 18:08 rcsilva83

In this case, it might be better to copy a jenv.config template into the config folder. I suppose your company has all its Java versions installed on C:/ProgramFiles/java/ or at some fixed path that won't change. Then you could create a jenv.config, add all the versions with custom names, and when a new user profile is created automatically copy the config file into %APPDATA%/JEnv

FelixSelter avatar Aug 31 '22 19:08 FelixSelter

Yes, this may do the trick for now. But I have 2 files there: jenv.config and jenv.config.json. On the second one there is information about locals and global too. Is it enough to only add versions to the first one?

BTW, I just see the new jenv add command on the original jEnv project. It doesn't require a name anymore and autocreate some alias for the specified installation. See here.

rcsilva83 avatar Aug 31 '22 19:08 rcsilva83

There should be one config file here: %APPDATA%/JEnv/jenv.config.json Every other file named jenv.config is most likely from an old version of jenv and can safely be deleted.

I thought of maybe a template name like ``java%version%` where %version% will be replaced by the java version. This would allow for more flexibility and could be expanded in the future. but let's discuss this in the new issue.

It would be exciting though if you would keep me up to date on how your company integrated jenv into the workflow. As I do not use windows anymore I often don't know what the problems are and what features are missing

FelixSelter avatar Aug 31 '22 19:08 FelixSelter