Skip to main content
JavaOptionsCli provides an interactive menu system for managing multiple Java versions on Linux systems. The tool uses update-alternatives under the hood to seamlessly switch between different Java installations.

Available commands

When you launch JavaOptionsCli, you’ll see an interactive menu with the following options:

New version Java

Install and register a new Java version from a tar file

Change version

Switch between installed Java versions

View list versions

Display all registered Java versions in the system

Delete version

Remove a Java version from system alternatives

Update list

Automatically select the highest priority Java version

How the menu works

The interactive menu is implemented in internal/menu.go:11-41 and uses the pterm library for rendering:
options := []string{
    "New Version Java",
    "Changes Version",
    "View List Versions",
    "Delete Version",
    "Update List",
    "Exit",
}

selected, _ := pterm.DefaultInteractiveSelect.WithOptions(options).WithMaxHeight(10).Show()
After each command completes, the menu automatically reappears, allowing you to perform multiple operations in a single session. Use arrow keys to navigate through the menu options and press Enter to select a command. Choose “Exit” to close the application.

Behind the scenes

All commands interact with Linux’s update-alternatives system, which manages symbolic links for commands that can have multiple versions installed. JavaOptionsCli manages three key Java binaries:
  • java - The Java runtime
  • javac - The Java compiler
  • jar - The Java archive tool
All Java installations are stored in /opt/java/ by default. Make sure this directory exists before installing new versions.

Build docs developers (and LLMs) love