# jEnv vs SDKMAN: gerenciando versões do Java

> jEnv vs SDKMAN para Java: um alternador de JDKs já instalados contra um instalador e gerenciador de JDKs e ferramentas da JVM. Escopo e adequação a CI comparados.

Source: https://latchkey.dev/pt/learn/tool-comparisons/jenv-vs-sdkman  
Updated: 2026-06-26

O jEnv alterna entre JDKs que você já instalou; o SDKMAN instala e gerencia JDKs além de outras ferramentas da JVM.

O jEnv é um alternador de versões fino: você instala os JDKs por conta própria (Homebrew, pacotes de fornecedores), os registra, e o jEnv define o JAVA_HOME por projeto via um arquivo .java-version. O SDKMAN vai além, instalando distribuições de JDK de muitos fornecedores e gerenciando Gradle, Maven, Kotlin e mais a partir de um catálogo. O jEnv é minimalista e se combina com o que quer que instale os JDKs; o SDKMAN é um instalador e gerenciador tudo-em-um.

## Comparison

|  | jEnv | SDKMAN |
| --- | --- | --- |
| Instala JDKs | Não (você instala) | Sim |
| Define JAVA_HOME | Sim, por projeto | Sim |
| Outras ferramentas da JVM | Não | Gradle, Maven, Kotlin, etc. |
| Arquivo de config | .java-version | Sem arquivo padrão |
| Melhor para | Alternar JDKs existentes | Instalar e gerenciar todas as ferramentas da JVM |

## No CI

No CI, os JDKs normalmente são fornecidos pelo setup-java, tornando o jEnv e o SDKMAN mais uma questão de paridade local. O jEnv serve a desenvolvedores que obtêm JDKs de um gerenciador de pacotes e só querem troca por projeto; o SDKMAN serve a equipes que querem uma ferramenta para instalar um JDK de fornecedor específico além de ferramentas de build. Qualquer um mantém as versões do Java local e do CI alinhadas.

## Acelere

Faça cache da instalação do JDK e dos caches das ferramentas de build com a chave baseada nas versões que você fixou e nos lockfiles. Ambos rodam em runners de CI; runners gerenciados mais rápidos encurtam as etapas de setup do JDK e de build.

## Decide with your own numbers, not a feature table

Feature comparisons age badly and rarely decide anything, because both tools in a mature category can do the job. What differs is how each behaves on your repository, and that takes one afternoon to measure.

```Terminal
# time a cold install with each candidate, cache cleared
hyperfine --prepare "rm -rf node_modules" --warmup 1 \
  "<tool-a> install" "<tool-b> install"

# and the thing CI actually pays for: a cold run with no local cache
docker run --rm -v "$(pwd):/w" -w /w node:22 sh -c "<tool> install"
```

> Measure the cold path. Warm local benchmarks favour whichever tool you already have cached, which is exactly the condition a CI runner never has.

## What actually changes when you switch

- Lockfile format. A switch is a one-way door for anyone still on the old tool until everyone migrates, so plan it as a single coordinated change.
- Resolution strictness. Tools differ on whether an undeclared transitive import works, and the stricter one will surface latent bugs as new failures.
- CI cache configuration. The cache path and key differ per tool; carrying over the old ones silently disables caching.
- Everyone on the team and every runner must move together. Pin the version so they cannot drift.

## O veredito

Já instalar JDKs de outra forma e precisar apenas de troca por projeto: jEnv. Querer uma ferramenta para instalar distribuições de JDK e ferramentas de build da JVM: SDKMAN. Muitos desenvolvedores JVM usam o SDKMAN para instalar e a troca no estilo jEnv só se preferirem um alternador separado.

## FAQ

### jEnv vs SDKMAN: Managing Java Versions?

jEnv is a thin version switcher: you install JDKs yourself (Homebrew, vendor packages), register them, and jEnv sets JAVA_HOME per project via a .java-version file. SDKMAN goes further, installing JDK distributions from many vendors and managing Gradle, Maven, Kotlin, and more from one catalog.

### In CI?

In CI, JDKs are usually provided by setup-java, making jEnv and SDKMAN more about local parity. jEnv suits developers who get JDKs from a package manager and just want per-project switching; SDKMAN suits teams that want one tool to install a specific vendor JDK plus build tools. Either keeps local and CI Java versions aligned.

### Speed it up?

Cache the JDK install and the build-tool caches keyed on your version pins and lockfiles. Both run on CI runners; faster managed runners shorten the JDK setup and build steps.

### Which should I choose?

Already installing JDKs another way and only needing per-project switching: jEnv. Wanting one tool to install JDK distributions and JVM build tools: SDKMAN. Many JVM developers use SDKMAN to install and jEnv-style switching only if they prefer a separate switcher.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
