> For the complete documentation index, see [llms.txt](https://appsecurity.gitbook.io/devops/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://appsecurity.gitbook.io/devops/ppc/ppc-langs/backend/jvm/java-env-manager.md).

# Java Env Manager

## VS Code Extension

Можно устанавливать последние версии Java через расширение [JDK](https://marketplace.visualstudio.com/items?itemName=Oracle.oracle-java). После установки `Settings -> Command Palette -> Download, install and use JDK`.

## jenv

Сложно вручную переключаться между окружениями и помнить, где что установлено.&#x20;

[jenv](https://github.com/jenv/jenv) — инструмент, который позволяет удобно управлять окружениями на компьютере.

Далее пример использования для MacOS:

<pre><code>$ brew install jenv

// Add to .zshrc
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"

// Install some version Java
$ brew install openjdk@11  // 11
$ brew install openjdk@8  // 8
$ brew install openjdk@17  // 17
$ brew install openjdk@18  // 18
<strong>
</strong><strong>// Чтобы система могла найти java, надо добавить линки в папку /Library/Java/JavaVirtualMachines/
</strong>$ sudo ln -sfn /usr/local/opt/openjdk@8/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-8.jdk
$ sudo ln -sfn /usr/local/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk
$ sudo ln -sfn /usr/local/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk
$ sudo ln -sfn /usr/local/opt/openjdk@18/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-18.jdk
<strong>
</strong><strong>// Add path to openjdk home to jenv
</strong><strong>$ jenv add /Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/
</strong>$ jenv add /Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home/
$ jenv add /Library/Java/JavaVirtualMachines/openjdk-17.jdk/Contents/Home/
$ jenv add /Library/Java/JavaVirtualMachines/openjdk-18.jdk/Contents/Home/
<strong>
</strong><strong>// Uvailable versions
</strong><strong>$ jenv versions
</strong><strong>
</strong><strong>// Set java env
</strong><strong>$ jenv global  // Установить глобально версию java
</strong><strong>$ jenv local   // Установить в локальной папке версию java
</strong><strong>$ jenv shell   // Установить в текущем терминале версию java
</strong></code></pre>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://appsecurity.gitbook.io/devops/ppc/ppc-langs/backend/jvm/java-env-manager.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
