Automatically download JRE for server if specified by version range

Description

Java providers like AdoptOpenJDK have a large number of different java builds across many platforms and an API to find the available versions and download them. Add in a method to specify the version of java to use in server.json that would download if necessary on server start.

  • Add a new JDK endpoint into CommandBox

  • Add a new property dedicated to specifying the Java version range into server.json

  • Automatically install on server start and dynamically set the jvm.javaHome for the user.

Activity

Show:

Brad Wood December 8, 2018 at 9:13 AM
Edited

New server java namespace has been added

  • server java list - View installed JREs/JDKs

  • server java install - install a new JRE/JDK

  • server java uninstall - Remove an existing JRE/JDK

  • server java search - Search for valid versions to install

CommandBox will install Java versions on demand when the server starts, if it's not already installed. Multiple servers will share the same JRE install so it's not duplicated on disk.

User can set global default JRE for all servers like so:

Overrides can also be placed in server.json as well as server start params

When starting a server, the version of java will be determined thusly:

  • First, take start command home dir

  • Then start command java version

  • Then server.json java home dir

  • Then server.json java version

  • Then server defaults java home dir

  • Then server defaults java versiom

  • If there is still no java home, use the same JRE as the CLI

Skip the API hit over the internet by specifying a full release name in your java version. For example, this server.json will hit the internet every time to verify the latest Java version:

But this server.json will hit find what it needs in artifacts right away and can work offline

If the API is unavailable, CommandBox will use the first OpenJDK artifact it can find that starts with the same major version and matches everything but the release name.

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Fix versions

Priority

Sentry

Created November 20, 2018 at 10:44 PM
Updated December 8, 2018 at 7:39 PM
Resolved December 8, 2018 at 7:39 PM