Stop Ruining Your Windows PATH: A Cleaner Way to Switch Java Versions

Java Version Switcher for Windows, switch java versions on windows easily, multiple java versions on windows

 If you’re a developer working on a Windows machine, you already know the pain.

You’re jumping between projects. One requires Java 17, another requires Java 21, and that legacy corporate monolith you try to avoid touching requires Java 8.

On macOS or Linux, you’d just spin up jenv or sdkman and call it a day. But on Windows? You’re stuck digging into the legacy System Environment Variables GUI, or blindly running setx commands hoping you don't accidentally truncate your system %PATH% because it went over the character limit.

Worse yet, setx changes don't apply to your current terminal session. You have to close your IDE, restart your terminal, and pray it worked.

I got tired of doing this manually, so I built a native Windows tool that fixes it the right way: jsw (Java Switcher Windows).

The Problem with Traditional Windows Path Switching

Most scripts that try to manage Java versions on Windows make the same mistake: they constantly rewrite your global environment strings. This leads to:

  1. Terminal Lock: Changes don't take effect immediately; you have to restart your command prompt or PowerShell instance.

  2. Broken IDEs: Build tools like Maven and Gradle get confused when %JAVA_HOME% changes out from underneath them while they're running.

  3. Admin Prompts: Constantly needing to open elevated prompts just to test a different build.

The Solution: A Pure Symlink Architecture

Instead of fighting the Windows PATH variable, jsw uses a Symlink / Shim-based approach.

When you install it, it adds a single, permanent pointer to your system path exactly once: C:\Program Files\Java\current

When you want to change your Java version, you just tell jsw what version you want. It instantly snaps the symbolic link to point to your target JDK folder.

Because the PATH variable never changes—only the folder the symlink points to—the switch happens instantly across every single open terminal window. No restarts required.

Zero Configuration Auto-Detection

I didn't want a tool where I had to manually register every new JDK I downloaded.

jsw features a lightweight PowerShell scanning engine. Every time you call it, it crawls the standard Windows installation directories (C:\Program Files\Java, Adoptium, Corretto, etc.). If you extract a new JDK version into those folders, it instantly registers it.

Here is what it looks like in action:

 
C:\> jsw
Available Java Versions:
  [8]  -> C:\Program Files\Java\jdk1.8.0_291
  [17] -> C:\Program Files\Java\jdk-17
  [21] -> C:\Program Files\Java\jdk-21
  [25] -> C:\Program Files\Java\jdk-25

Current Active Version Target: C:\Program Files\Java\jdk-17

Want to upgrade a project to the latest version? Just type:

jsw 25

Boom. You're now running Java 25 system-wide.

Built for Modern Devs (and AI Agents)

Because the CLI syntax is completely predictable and idempotent, it’s also highly optimized for automated CI/CD runners or local AI coding agents (like Claude or GitHub Copilot Workspace). If an agent needs to switch environments to run a local test suite, it can execute jsw <version> headlessly without risking breaking your shell environment.

Try It Out

It's completely free, open-source, and has zero external dependencies. You can set it up in about 30 seconds.

👉 Check out the project on GitHub: aleem-raja/java-version-switcher-windows

If this saves you a few environment variable headaches, feel free to drop a ⭐️ on the repo! Let me know in the comments how you guys are managing your local environments on Windows.