Linux command
cs-java 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
List available JDK
cs java --available
Install a specific JDK
cs java --jvm [adopt:11] --setup
Set default Java
cs java --jvm [graalvm-java17] --setup
Show current Java
cs java --env
List installed JDKs
cs java --installed
Install and use
cs java --jvm [temurin:21]
说明
cs java is Coursier's Java version manager, providing easy installation and switching between different JDK distributions and versions. It supports numerous distributions including AdoptOpenJDK, Temurin, GraalVM, Corretto, and Zulu. The command downloads and manages JDK installations automatically, configuring environment variables to use the selected version. Multiple versions can be installed simultaneously with easy switching between them. This tool simplifies Java development environment setup, particularly useful for testing across Java versions or using distribution-specific features like GraalVM's native compilation.
参数
- --available
- List all available JDK distributions and versions.
- --jvm _JVM_
- Specify JDK distribution and version (e.g., adopt:11, temurin:21).
- --setup
- Configure the specified JDK as the default.
- --env
- Print environment variables for the current Java setup.
- --installed
- List locally installed JDK versions.
- --update
- Update to the latest patch version.
- --home
- Print the JAVA_HOME path for specified JVM.
FAQ
What is the cs-java command used for?
cs java is Coursier's Java version manager, providing easy installation and switching between different JDK distributions and versions. It supports numerous distributions including AdoptOpenJDK, Temurin, GraalVM, Corretto, and Zulu. The command downloads and manages JDK installations automatically, configuring environment variables to use the selected version. Multiple versions can be installed simultaneously with easy switching between them. This tool simplifies Java development environment setup, particularly useful for testing across Java versions or using distribution-specific features like GraalVM's native compilation.
How do I run a basic cs-java example?
Run `cs java --available` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --available do in cs-java?
List all available JDK distributions and versions.