How to switch between the multiple Java versions(JDK) in Windows 11

Pubblicato il: 11 luglio 2025
sul canale di: Kavi Coder
314
7

Learn how to manually switch between multiple Java versions on Windows 11 using environment variables and a simple .BAT script! Whether you're a developer working with multiple JDKs or running legacy Java apps, this step-by-step tutorial will show you how to:

✅ Set JAVA_HOME
✅ Update your system PATH
✅ Easily switch between Java versions using a script file

🎯 .BAT Script Example:

@echo off
set "JDK_VERSION=%1"
if "%JDK_VERSION%"=="" (
echo Usage: jdk [21|24]
exit /b 1
)
set "JAVA_HOME=C:\Program Files\Java\jdk-%JDK_VERSION%"
setx JAVA_HOME "C:\Program Files\Java\jdk-%JDK_VERSION%" /m
echo Switched to JDK %JDK_VERSION%

📌 Just change the path to match your installed Java directory.

🔧 Java Versions Used in this Video:
JDK 21
JDK 24

📁 Typical install paths:
C:\Program Files\Java\jdk-21
C:\Program Files\Java\jdk-24

💬 Drop a comment if you have any questions or need help troubleshooting.
👍 Like & subscribe for more Java tips, Windows tricks, and coding tutorials!


In questa pagina del sito puoi guardare il video online How to switch between the multiple Java versions(JDK) in Windows 11 della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Kavi Coder 11 luglio 2025, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 314 volte e gli è piaciuto 7 spettatori. Buona visione!