jenv
jenv is a command line tool that is used for managing and switching between different Java environments on macOS, Linux, and other UNIX-like systems. It provides a convenient way to switch between different versions of Java installed on your machine.
It allows you to install multiple versions of Java side by side and set a default version for your system. This is particularly useful when you have projects or applications that require specific Java versions.
One of the key features of jenv is the ability to configure the Java version on a per-directory basis. This means you can set different Java versions for different projects, ensuring that each project uses the correct version.
jenv also integrates with popular build tools like Maven and Gradle, allowing you to easily switch the Java version for your specific build processes.
Additionally, jenv provides commands to list available Java versions, set the global Java version, set the Java version for the current directory, and manage JDK installations.
It supports both Oracle JDK and OpenJDK installations and allows you to specify the Java version using various formats, such as a path to the JDK installation directory or a version string.
jenv uses environment variables to manage the Java version, making it compatible with various shells. It also supports automatic Java version switching based on the directory you are in.
The tool is highly customizable, allowing you to configure additional plugins, define custom Java versions, and add Java options or system properties.
Overall, jenv simplifies the process of managing multiple Java versions on your machine and ensures that the appropriate Java environment is used for each project or task.
List of commands for jenv:
-
jenv:tldr:0791f jenv: Display the current JDK version used.$ jenv versiontry on your machineexplain this command
-
jenv:tldr:2f611 jenv: Display all managed JDKs.$ jenv versionstry on your machineexplain this command
-
jenv:tldr:8e719 jenv: Add a Java version to jEnv.$ jenv add ${path-to-jdk_home}try on your machineexplain this command
-
jenv:tldr:94db6 jenv: Enable a jEnv plugin.$ jenv enable-plugin ${plugin_name}try on your machineexplain this command
-
jenv:tldr:b6258 jenv: Set the JDK version for the current shell session.$ jenv shell ${java_version}try on your machineexplain this command
-
jenv:tldr:c7383 jenv: Set the global JDK version.$ jenv global ${java_version}try on your machineexplain this command