Skip to content

Option to download and install java versions #35

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

Open
rcsilva83 opened this issue Aug 17, 2022 · 8 comments
Open

Option to download and install java versions #35

rcsilva83 opened this issue Aug 17, 2022 · 8 comments

Comments

@rcsilva83
Copy link
Collaborator

Would be super convenient if jenv could not only switch Java versions, but also had the ability to go ahead and install the configured version. It's also desirable the ability do configure a "dist URL" to be able to download from a local mirror when the user is behind a corporate firewall.

@FelixSelter
Copy link
Owner

Im not sure if this should really be a jenv feature.
If this feature would be implemented the only thing it would do is downloading the installer from the java website and running the exe.
This would save the user 1 google query and 3 clicks.
However by manipulating the jenv script or hosts.txt security vulnerabilities could be introduced easily.
It might even trigger some anti virus applications when an application downloads code from the internet and executes it.

What I could imagine is that jenv automatically opens the website of the desired version.

But what do you think? You may still convince me of this feature

@rcsilva83
Copy link
Collaborator Author

This is a feature provided by SDKman and it seems to work fine.

I think you can see the real benefit from this feature when you think on a scale of hundreds of developers on an organization. Better yet, if we had a .jenv file with the JDK version on the project, it would be possible to git clone and type some kind of jenv config command that would download and set the JDK for it.

@FelixSelter
Copy link
Owner

Yea I start liking the idea. This can easily be integrated with #36
See my comment on the linked pull request for further details.

The only question remaining is how to find out where the user installed the java version.
May #32 can be implemented efficiently.

I also remember that you could pass a command line argument to the java installer to run silently in the background and install to a specific location. But I doubt it would be a good idea to take that much control from the user. What if he wants to but it at another drive?

Further investigation is needed

@ebresie
Copy link

ebresie commented Aug 21, 2022

Not sure if this helps, but Disco API may provide an interface with a catalog of available openjdk distributions.

@FelixSelter
Copy link
Owner

Wow thank you. That makes it a lot easier.
Will need to see if they work with silent installation.
But in theory I only have to call https://api.foojay.io/disco/v3.0/packages?version=<version>&operating_system=windows&directly_downloadable=true&archive_type=msi now

@FelixSelter
Copy link
Owner

FelixSelter commented Aug 31, 2022

To retrieve the architecture for disco api we could use the following:

$architecture = Get-CimInstance -ClassName Win32_Processor | Select-Object -ExpandProperty Architecture

$architecture can then be the following:

x86 (0)
MIPS (1)
Alpha (2)
PowerPC (3)
ARM (5)
ia64 (6)
x64 (9)
ARM64 (12)

[System.Environment]::Is64BitOperatingSystem

@FelixSelter
Copy link
Owner

@rcsilva83 Would your distro url look something like this: ``https://example.com/%version%/download/installer.msi`
If not could you provide an example?

@dibog
Copy link

dibog commented Feb 22, 2023

Similiar tools like 'pyenv' and 'nvm' also list of available versions and do the actual download of the tools.
It would be great if jenv could do the same.

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

4 participants