cs-java
Run Checkstyle to analyze Java code
TLDR
Display Java version by using coursier
Call a specific Java version with custom properties using coursier
List all the available JVM in the coursier default index
List all the installed JVM in the system with his own location
Set a specific JVM as one-off default for the shell instance
Revert the changes for the default JVM settings
Set a specific JVM as default for the whole system
SYNOPSIS
cs-java subcommand [<version>]
PARAMETERS
list
Displays all available and locally installed Java versions.
install <version>
Downloads and installs the specified Java version (e.g., openjdk11, openjdk17).
use <version>
Sets the specified installed version as the default in PATH.
default
Shows the currently active default Java version.
DESCRIPTION
The cs-java command is a CloudShell-specific utility in AWS CloudShell, a browser-based shell environment for AWS users. It simplifies the installation, management, and switching of Java Development Kit (JDK) versions, primarily OpenJDK variants like 11, 17, and 21. CloudShell pre-installs a default Java, but cs-java allows customization without sudo privileges or package managers.
Key functions include listing available versions, installing specific ones to ~/.cs/java, and setting the active version via symbolic links in PATH. This ensures compatibility for Java-based tools, AWS SDKs, or custom applications directly in the console. Usage integrates seamlessly with CloudShell's persistent home directory, persisting installations across sessions.
Ideal for developers testing multi-version Java apps or using AWS services like Lambda, ECS, or CodeBuild that require specific JDKs. It abstracts complexities of manual downloads and configurations, enhancing productivity in ephemeral shell sessions.
CAVEATS
Exclusive to AWS CloudShell; unavailable on standard Linux systems. Installations limited to CloudShell home directory (~/.cs/java). Requires internet for downloads. Versions are OpenJDK only.
EXAMPLES
cs-java list
cs-java install openjdk17
cs-java use openjdk17
cs-java default
AVAILABLE VERSIONS
Common: openjdk8, openjdk11, openjdk17, openjdk21. Run cs-java list for latest.
HISTORY
Introduced in 2019 with AWS CloudShell public preview. Evolved to support more JDK versions aligning with AWS service requirements, like Java 21 for Lambda in 2023.
SEE ALSO
cs-python(1), cs-node(1), java(1), update-alternatives(8)


