A simple Go program to manage and install (if not found) various JDKs.
Useful for when you use multiple JDK implementations, or want to build on different versions to test your Java projects or other JVM language projects on different standard libraries.
Creates a directory .jdkenv
in the $HOME
directory, and will contain the downloaded JDK .tar.gz archives
fully extracted. Once a JDK has been selected, an env
file will be created within the .jdkenv
directory
that can then be sourced via a shell recfile. (.bashrc
, .zshrc
, .profile
, etc.)
Takes quite a lot of inspiration from how JetBrains' IntelliJ IDEA IDE can download and use various JDKs.
(Even the .toml
files take quite a lot of inspiration from IntelliJ’s *.intellij
files for its known JDKs.)
Note
|
Environment variable setting not yet implemented. macOS testing needs to be done, as well as determining the best way of writing to Window’s environment variables. |
Running this program without a subcommand will only print the set JDK and Java version given.
Usage: jdkenv [flags] jdkenv [command] Available Commands: azul Set usage of Azul Zulu Community JDK corretto Set usage of Amazon Corretto JDK errors Print error codes and their meanings help Help about any command liberica Set usage of BellSoft Liberica JDK local Set usage of a locally installed JDK openjdk Set usage of AdoptOpenJDK oracle Set usage of Oracle OpenJDK Reference Implementation sapmachine A brief description of your command system Set usage of system installed JDK Flags: -h, --help help for jdkenv -j, --java int use specific Java version (valid: 8, 11, 15) (default 8) --no-color use monochrome output --spinner disables the activity spinner (default true)
JDK Implementation | Java 8 | Java 11 | Java 15 | Notes |
---|---|---|---|---|
Oracle OpenJDK |
✓ |
✓ |
✓ |
|
Amazon Corretto |
✓ |
✓ |
|
|
BellSoft Liberica |
✓ |
✓ |
✓ |
|
AdoptOpenJDK |
✓ |
✓ |
✓ |
|
SAP Sapmachine |
✓ |
✓ |
|
|
Azul Zulu Community |
✓ |
✓ |
✓ |
|
JDKEnv is licensed under the Apache 2.0 License. See LICENSE for more details.
-
briandowns/spinner (Apache-2.0)
-
cavaliercoder/grab (BSD-3)
-
logrusorgru/aurora (Unlicense)
-
mholt/archiver (MIT)
-
pelletier/go-toml (MIT)
-
spf13/cobra (Apache-2.0)
-
go-ini/ini (Apache-2.0)