[{"data":1,"prerenderedAt":360},["ShallowReactive",2],{"searchBlogPosts":3,"content-\u002Fblog\u002Fhow-to-update-to-java21":28},[4,7,10,13,16,19,22,25],{"_path":5,"title":6},"\u002Fblog\u002F2026\u002F03\u002F14\u002Fposthog-observability-tongueflow","How I Used PostHog to Add Observability to My Web App as a Junior DevOps Engineer",{"_path":8,"title":9},"\u002Fblog\u002F2025\u002F10\u002F05\u002Faws-cloud-operations-certification-journey-ssm-lab","AWS Cloud Operations Certification Journey: Mastering Systems Manager",{"_path":11,"title":12},"\u002Fblog\u002F2025\u002F03\u002F14\u002Fansible-setup-configuration","Ansible Setup and Configuration",{"_path":14,"title":15},"\u002Fblog\u002F2025\u002F01\u002F05\u002Fdata-sharing-with-nfs","Data Sharing with NFS: A Complete Guide for System Administrators",{"_path":17,"title":18},"\u002Fblog\u002F2024\u002F05\u002F23\u002Fjava-29th-birth","Java celebrates 29 years of history",{"_path":20,"title":21},"\u002Fblog\u002F2024\u002F03\u002F19\u002Fhow-to-update-to-java21","How to Update to Java 21 Using SDKMAN",{"_path":23,"title":24},"\u002Fblog\u002F2024\u002F02\u002F11\u002Fspring-async-retry","Implementing Asynchronous Retry Mechanism for Email Sending in Spring Applications",{"_path":26,"title":27},"\u002Fblog\u002F2024\u002F01\u002F25\u002Fjdbc-vs-jpa","JDBC vs JPA: Which is Better for Your Application?",{"_path":20,"_dir":29,"_draft":30,"_partial":30,"_locale":31,"title":21,"description":32,"slug":33,"date":34,"published":35,"author":36,"tags":37,"cover":46,"keywords":47,"body":48,"_type":353,"_id":354,"_source":355,"_file":356,"_stem":357,"_extension":358,"sitemap":359},"19",false,"","Upgrade to Java 21 with SDKMAN: Quick Guide","how-to-update-to-java21","2024-03-19T16:00:00.000Z",true,"Nidhal Naffati",[38,39,40,41,42,43,44,45],"Java","Java 21","SDKMAN","JDK","Development","Programming","OpenJDK","Oracle JDK","how-to-update-to-java21.png","Java, Java 21, SDKMAN, JDK, Development, Programming, OpenJDK, Oracle JDK",{"type":49,"children":50,"toc":339},"root",[51,59,66,71,77,93,99,104,111,116,122,127,178,184,189,217,222,227,233,238,265,270,276,281,302,307,312,318,323,328,333],{"type":52,"tag":53,"props":54,"children":55},"element","p",{},[56],{"type":57,"value":58},"text","Java 21, the latest version of the Java Development Kit (JDK), has just been released with exciting new features and\nimprovements. If you're a Java developer and want to start using Java 21 for your projects, SDKMAN makes the process\nsimple and efficient. In this guide, we'll walk you through the steps to update to Java 21 using SDKMAN.",{"type":52,"tag":60,"props":61,"children":63},"h2",{"id":62},"what-is-sdkman",[64],{"type":57,"value":65},"What is SDKMAN?",{"type":52,"tag":53,"props":67,"children":68},{},[69],{"type":57,"value":70},"SDKMAN is a powerful and convenient tool for managing multiple versions of SDKs and software packages, including various\nJava JDK versions. It simplifies the process of installing, switching, and managing different Java versions on your\ndevelopment machine.",{"type":52,"tag":60,"props":72,"children":74},{"id":73},"prerequisites",[75],{"type":57,"value":76},"Prerequisites",{"type":52,"tag":53,"props":78,"children":79},{},[80,82,91],{"type":57,"value":81},"Before you begin, make sure you have SDKMAN installed on your system. If you haven't already, you can follow the\ninstallation instructions on the SDKMAN website ",{"type":52,"tag":83,"props":84,"children":88},"a",{"href":85,"rel":86},"https:\u002F\u002Fsdkman.io\u002Finstall",[87],"nofollow",[89],{"type":57,"value":90},"SDKMAN website",{"type":57,"value":92},".",{"type":52,"tag":60,"props":94,"children":96},{"id":95},"updating-to-java-21",[97],{"type":57,"value":98},"Updating to Java 21",{"type":52,"tag":53,"props":100,"children":101},{},[102],{"type":57,"value":103},"Here are the steps to update to Java 21 using SDKMAN:",{"type":52,"tag":105,"props":106,"children":108},"h3",{"id":107},"step-1-open-a-terminal",[109],{"type":57,"value":110},"Step 1: Open a Terminal",{"type":52,"tag":53,"props":112,"children":113},{},[114],{"type":57,"value":115},"Open your terminal or command prompt. SDKMAN operates primarily through the command line, so you'll need to use a\nterminal window to execute the necessary commands.",{"type":52,"tag":105,"props":117,"children":119},{"id":118},"step-2-check-for-available-java-versions",[120],{"type":57,"value":121},"Step 2: Check for Available Java Versions",{"type":52,"tag":53,"props":123,"children":124},{},[125],{"type":57,"value":126},"Before installing Java 21, it's a good idea to check if it's available through SDKMAN. Use the following command to list\nthe available Java versions:",{"type":52,"tag":128,"props":129,"children":133},"pre",{"className":130,"code":131,"language":132,"meta":31,"style":31},"language-bash shiki shiki-themes nord github-dark monokai","sdk list java | grep 21\n","bash",[134],{"type":52,"tag":135,"props":136,"children":137},"code",{"__ignoreMap":31},[138],{"type":52,"tag":139,"props":140,"children":143},"span",{"class":141,"line":142},"line",1,[144,150,156,161,167,172],{"type":52,"tag":139,"props":145,"children":147},{"style":146},"--shiki-default:#88C0D0;--shiki-dark:#B392F0;--shiki-sepia:#A6E22E",[148],{"type":57,"value":149},"sdk",{"type":52,"tag":139,"props":151,"children":153},{"style":152},"--shiki-default:#A3BE8C;--shiki-dark:#9ECBFF;--shiki-sepia:#E6DB74",[154],{"type":57,"value":155}," list",{"type":52,"tag":139,"props":157,"children":158},{"style":152},[159],{"type":57,"value":160}," java",{"type":52,"tag":139,"props":162,"children":164},{"style":163},"--shiki-default:#81A1C1;--shiki-dark:#F97583;--shiki-sepia:#F92672",[165],{"type":57,"value":166}," |",{"type":52,"tag":139,"props":168,"children":169},{"style":146},[170],{"type":57,"value":171}," grep",{"type":52,"tag":139,"props":173,"children":175},{"style":174},"--shiki-default:#B48EAD;--shiki-dark:#79B8FF;--shiki-sepia:#AE81FF",[176],{"type":57,"value":177}," 21\n",{"type":52,"tag":105,"props":179,"children":181},{"id":180},"step-3-install-java-21",[182],{"type":57,"value":183},"Step 3: Install Java 21",{"type":52,"tag":53,"props":185,"children":186},{},[187],{"type":57,"value":188},"To install Java 21, use the following command:",{"type":52,"tag":128,"props":190,"children":192},{"className":130,"code":191,"language":132,"meta":31,"style":31},"sdk install java 21-oracle\n",[193],{"type":52,"tag":135,"props":194,"children":195},{"__ignoreMap":31},[196],{"type":52,"tag":139,"props":197,"children":198},{"class":141,"line":142},[199,203,208,212],{"type":52,"tag":139,"props":200,"children":201},{"style":146},[202],{"type":57,"value":149},{"type":52,"tag":139,"props":204,"children":205},{"style":152},[206],{"type":57,"value":207}," install",{"type":52,"tag":139,"props":209,"children":210},{"style":152},[211],{"type":57,"value":160},{"type":52,"tag":139,"props":213,"children":214},{"style":152},[215],{"type":57,"value":216}," 21-oracle\n",{"type":52,"tag":53,"props":218,"children":219},{},[220],{"type":57,"value":221},"Replace \"21-oracle\" with the exact version you want to install if there's a newer version available or if you want\nanother Java vendor.",{"type":52,"tag":53,"props":223,"children":224},{},[225],{"type":57,"value":226},"SDKMAN will download and install Java 21 for you. This process may take a few minutes depending on your internet\nconnection and system performance.",{"type":52,"tag":105,"props":228,"children":230},{"id":229},"step-4-set-java-21-as-the-default-version",[231],{"type":57,"value":232},"Step 4: Set Java 21 as the Default Version",{"type":52,"tag":53,"props":234,"children":235},{},[236],{"type":57,"value":237},"To make Java 21 the default Java version on your system, use the following command:",{"type":52,"tag":128,"props":239,"children":241},{"className":130,"code":240,"language":132,"meta":31,"style":31},"sdk use java 21-oracle\n",[242],{"type":52,"tag":135,"props":243,"children":244},{"__ignoreMap":31},[245],{"type":52,"tag":139,"props":246,"children":247},{"class":141,"line":142},[248,252,257,261],{"type":52,"tag":139,"props":249,"children":250},{"style":146},[251],{"type":57,"value":149},{"type":52,"tag":139,"props":253,"children":254},{"style":152},[255],{"type":57,"value":256}," use",{"type":52,"tag":139,"props":258,"children":259},{"style":152},[260],{"type":57,"value":160},{"type":52,"tag":139,"props":262,"children":263},{"style":152},[264],{"type":57,"value":216},{"type":52,"tag":53,"props":266,"children":267},{},[268],{"type":57,"value":269},"This sets Java 21 as the default Java version for your current terminal session. If you want to make it the default\nsystem-wide, you can use the same command without specifying a terminal session.",{"type":52,"tag":105,"props":271,"children":273},{"id":272},"step-5-verify-the-installation",[274],{"type":57,"value":275},"Step 5: Verify the Installation",{"type":52,"tag":53,"props":277,"children":278},{},[279],{"type":57,"value":280},"To verify that Java 21 has been successfully installed and set as the default version, you can use the following\ncommands:",{"type":52,"tag":128,"props":282,"children":284},{"className":130,"code":283,"language":132,"meta":31,"style":31},"java -version\n",[285],{"type":52,"tag":135,"props":286,"children":287},{"__ignoreMap":31},[288],{"type":52,"tag":139,"props":289,"children":290},{"class":141,"line":142},[291,296],{"type":52,"tag":139,"props":292,"children":293},{"style":146},[294],{"type":57,"value":295},"java",{"type":52,"tag":139,"props":297,"children":299},{"style":298},"--shiki-default:#A3BE8C;--shiki-dark:#79B8FF;--shiki-sepia:#AE81FF",[300],{"type":57,"value":301}," -version\n",{"type":52,"tag":53,"props":303,"children":304},{},[305],{"type":57,"value":306},"This command should display the Java 21 version information.",{"type":52,"tag":53,"props":308,"children":309},{},[310],{"type":57,"value":311},"Congratulations! You have successfully updated to Java 21 using SDKMAN. You can now start using the latest features and\nimprovements in your Java projects.",{"type":52,"tag":60,"props":313,"children":315},{"id":314},"conclusion",[316],{"type":57,"value":317},"Conclusion",{"type":52,"tag":53,"props":319,"children":320},{},[321],{"type":57,"value":322},"SDKMAN simplifies the process of managing different Java versions, making it easy for developers to stay up-to-date with\nthe latest releases. Updating to Java 21 using SDKMAN is a straightforward process that ensures you have access to the\nlatest Java features and enhancements for your development needs.",{"type":52,"tag":53,"props":324,"children":325},{},[326],{"type":57,"value":327},"Now that you have Java 21 installed, you're ready to take advantage of its new capabilities and build amazing Java\napplications.",{"type":52,"tag":53,"props":329,"children":330},{},[331],{"type":57,"value":332},"Happy coding! 💻 😉",{"type":52,"tag":334,"props":335,"children":336},"style",{},[337],{"type":57,"value":338},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html .sepia .shiki span {color: var(--shiki-sepia);background: var(--shiki-sepia-bg);font-style: var(--shiki-sepia-font-style);font-weight: var(--shiki-sepia-font-weight);text-decoration: var(--shiki-sepia-text-decoration);}html.sepia .shiki span {color: var(--shiki-sepia);background: var(--shiki-sepia-bg);font-style: var(--shiki-sepia-font-style);font-weight: var(--shiki-sepia-font-weight);text-decoration: var(--shiki-sepia-text-decoration);}",{"title":31,"searchDepth":340,"depth":340,"links":341},2,[342,343,344,352],{"id":62,"depth":340,"text":65},{"id":73,"depth":340,"text":76},{"id":95,"depth":340,"text":98,"children":345},[346,348,349,350,351],{"id":107,"depth":347,"text":110},3,{"id":118,"depth":347,"text":121},{"id":180,"depth":347,"text":183},{"id":229,"depth":347,"text":232},{"id":272,"depth":347,"text":275},{"id":314,"depth":340,"text":317},"markdown","content:blog:2024:03:19:how-to-update-to-java21.md","content","blog\u002F2024\u002F03\u002F19\u002Fhow-to-update-to-java21.md","blog\u002F2024\u002F03\u002F19\u002Fhow-to-update-to-java21","md",{"loc":20},1773617924627]