{"id":22209,"date":"2023-10-01T16:37:53","date_gmt":"2023-10-01T16:37:53","guid":{"rendered":"https:\/\/linuxways.net\/?p=22209"},"modified":"2023-10-01T16:37:53","modified_gmt":"2023-10-01T16:37:53","slug":"how-to-install-and-setup-java-in-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-and-setup-java-in-ubuntu-22-04\/","title":{"rendered":"How to Install and Setup Java in Ubuntu 22.04?"},"content":{"rendered":"<p><strong>Java <\/strong>is a commonly utilized <strong>object-oriented <\/strong>programming language which is a very secure, quick, and trustworthy language. Java is mostly used in <strong>website<\/strong> and <strong>application <\/strong>development. It helps users in creating games(mobile or computer), websites, and other applications. <strong>Ubuntu<\/strong> is an operating system software that is Linux-based. Users can implement and run Java programs in Ubuntu. To implement this, users have to install Java in Ubuntu.<\/p>\n<p>This article will demonstrate some methods to install Java in Ubuntu 22.04:<\/p>\n<ul>\n<li>Method 1: Through OpenJDK18<\/li>\n<li>Method 2: Through Java Development SE Kit 21<\/li>\n<\/ul>\n<h2><strong>Method 1: How to Install\/Setup Java in Ubuntu 22.04 via OpenJDK18?<\/strong><\/h2>\n<p><strong>OpenJDK18 <\/strong>(Open Java Development Kit) is an open-source Java Development Kit of version 18, which means free source code availability that can be utilized by all users. OpenJDK consists of some packages including JRE and JDK. Java Development Kit(<strong>JDK<\/strong>) is used for the development of Java applications whereas <strong>JRE (<\/strong>Java Runtime Environment) is needed to execute applications of Java.<\/p>\n<p>To install Java in Ubuntu 22.04 via OpenJDK 18, we should follow the below-mentioned steps:<\/p>\n<ul>\n<li>Update System Packages\/Repositories<\/li>\n<li>OpenJDK 18 Installation<\/li>\n<li>OpenJDK 18 JRE Installation<\/li>\n<\/ul>\n<h3><strong>Step 1: Update System Packages\/Repositories<\/strong><\/h3>\n<p>The convenient option for installing Java is from default packages\/repositories. For that, first, open the terminal and update the packages\/repositories by using the below-listed command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt update<\/div><\/div>\n<p>\u201c<strong>apt<\/strong>\u201d is a tool used for application installations and management.<\/p>\n<p>The <strong>update <\/strong>command will update all the existing packages:<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1137\" height=\"267\" class=\"wp-image-22221\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-1.png 1137w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-1-300x70.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-1-1024x240.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-1-768x180.png 768w\" sizes=\"auto, (max-width: 1137px) 100vw, 1137px\" \/><\/strong><\/p>\n<h3><strong>Step 2: OpenJDK 18 Installation<\/strong><\/h3>\n<p>Depending on user choice or preference, install\/download OpenJDK or JRE on Ubuntu 22.04. To get OpenJDK below-listed command is used:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> <span class=\"re5\">-y<\/span> openjdk-<span class=\"nu0\">18<\/span>-jdk<\/div><\/div>\n<p>\u201c<strong>-y<\/strong>\u201d means yes to all prompts during installation packages, so that prompt doesn\u2019t pause during the installation process until the user replies to yes and continues the further process as generally prompts do.<\/p>\n<p>In this way, OpenJDK will install:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1126\" height=\"796\" class=\"wp-image-22225\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-2.png 1126w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-2-300x212.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-2-1024x724.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-2-768x543.png 768w\" sizes=\"auto, (max-width: 1126px) 100vw, 1126px\" \/><\/p>\n<p>The below output shows that the installation has been completed:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1123\" height=\"796\" class=\"wp-image-22228\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-3.png 1123w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-3-300x213.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-3-1024x726.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-3-768x544.png 768w\" sizes=\"auto, (max-width: 1123px) 100vw, 1123px\" \/><\/p>\n<h3><strong>Step 3: OpenJDK 18 JRE Installation <\/strong><\/h3>\n<p>If users have JDK installed, there is no need for JRE as JRE is a part of JDK<strong>. <\/strong>However, if specifically, the user wants to install OpenJDK 18 JRE in Ubuntu 22.04, utilize the below-mentioned command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> <span class=\"re5\">-y<\/span> openjdk-<span class=\"nu0\">18<\/span>-jre<\/div><\/div>\n<p>The above command will install OpenJDK 18 JRE:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1205\" height=\"283\" class=\"wp-image-22230\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-4.png 1205w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-4-300x70.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-4-1024x240.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-4-768x180.png 768w\" sizes=\"auto, (max-width: 1205px) 100vw, 1205px\" \/><\/p>\n<h2><strong>Method 2: How to Install\/Download Java in Ubuntu 22.04 via Java Development SE Kit 21?<\/strong><\/h2>\n<p><strong>Java Development SE Kit 21 <\/strong>also contains various tools for developing, debugging, and running Java applications.<\/p>\n<p>To install Java Development SE Kit 18 in Ubuntu 22.04, check out the below-listed steps:<\/p>\n<ul>\n<li>Updation of System Repositories\/Packages<\/li>\n<li>Installation of Necessary Dependencies<\/li>\n<li>Download of Java Development SE Kit 21<\/li>\n<li>Installation of Java Development SE Kit 21<\/li>\n<li>Java Environment Configuration<\/li>\n<li>Check Java Version<\/li>\n<\/ul>\n<h3><strong>Step 1: Updation of System Repositories\/Packages <\/strong><\/h3>\n<p>First, open the terminal and update the packages\/repositories by using the provided command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt update<\/div><\/div>\n<p>The above command will update all the packages:<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1371\" height=\"292\" class=\"wp-image-22236\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-5.png 1371w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-5-300x64.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-5-1024x218.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-5-768x164.png 768w\" sizes=\"auto, (max-width: 1371px) 100vw, 1371px\" \/><\/strong><\/p>\n<h3><strong>Step 2: Installation of Necessary Dependencies<\/strong><\/h3>\n<p>To run the program efficiently, dependencies are used. Dependencies include modules, packages, and libraries. The below-mentioned command is utilized to install the required dependencies:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> <span class=\"re5\">-y<\/span> libc6-x32 libc6-i386<\/div><\/div>\n<p>\u201c<strong>libc<\/strong>\u201d is an acronym for standard C library. \u201c<strong>libc6-x32<\/strong>\u201d is a package that includes the shared version of libc. \u201c<strong>libc-i386<\/strong>\u201d is the 1386 version of the standard C library used for i386 systems.<\/p>\n<p>The output will show the installation process of dependencies:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1451\" height=\"581\" class=\"wp-image-22239\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-6.png 1451w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-6-300x120.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-6-1024x410.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-6-768x308.png 768w\" sizes=\"auto, (max-width: 1451px) 100vw, 1451px\" \/><\/p>\n<h3><strong>Step 3: Download Java Development SE Kit 21<\/strong><\/h3>\n<p>Java Development SE Kit 21 package can be downloaded from the <a href=\"https:\/\/www.oracle.com\/java\/technologies\/downloads\/#java18\">Official Website<\/a> via the \u201c<strong>wget<\/strong>\u201d command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">wget<\/span> https:<span class=\"sy0\">\/\/<\/span>download.oracle.com<span class=\"sy0\">\/<\/span>java<span class=\"sy0\">\/<\/span><span class=\"nu0\">21<\/span><span class=\"sy0\">\/<\/span>latest<span class=\"sy0\">\/<\/span>jdk-<span class=\"nu0\">21<\/span>_linux-x64_bin.deb<\/div><\/div>\n<p>It can be observed that the latest version of Java Development SE Kit has been downloaded successfully:<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1528\" height=\"375\" class=\"wp-image-22245\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-7.png 1528w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-7-300x74.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-7-1024x251.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-7-768x188.png 768w\" sizes=\"auto, (max-width: 1528px) 100vw, 1528px\" \/><\/strong><\/p>\n<h3><strong>Step 4: Installation of Java Development SE Kit 21<\/strong><\/h3>\n<p>Now, to install Java Development SE Kit 21 in Ubuntu 22.04, the below-given command is used:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> .<span class=\"sy0\">\/<\/span>jdk-<span class=\"nu0\">21<\/span>_linux-x64_bin.deb<\/div><\/div>\n<p>The above-mentioned command will install the Java Development SE Kit 21<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1547\" height=\"489\" class=\"wp-image-22249\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-8.png 1547w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-8-300x95.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-8-1024x324.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-8-768x243.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-8-1536x486.png 1536w\" sizes=\"auto, (max-width: 1547px) 100vw, 1547px\" \/> <\/strong><\/p>\n<h3><strong>Step 5: Java Environment Configuration<\/strong><\/h3>\n<p>After installation, Java Environment Configuration should be done. To do so, use the below commands one by one:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">$ <span class=\"kw2\">cat<\/span> <span class=\"sy0\">&lt;&lt;<\/span>EOF <span class=\"sy0\">|<\/span> <span class=\"kw2\">sudo<\/span> <span class=\"kw2\">tee<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>profile.d<span class=\"sy0\">\/<\/span>jdk21.sh<br \/>\n<br \/>\n<span class=\"sy0\">&gt;<\/span> <span class=\"kw3\">export<\/span> <span class=\"re2\">JAVA_HOME<\/span>=<span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>lib<span class=\"sy0\">\/<\/span>jvm<span class=\"sy0\">\/<\/span>jdk-<span class=\"nu0\">21<\/span><br \/>\n<br \/>\n<span class=\"sy0\">&gt;<\/span> <span class=\"kw3\">export<\/span> <span class=\"re2\">PATH<\/span>=\\<span class=\"re1\">$PATH<\/span>:\\<span class=\"re1\">$JAVA_HOME<\/span><span class=\"sy0\">\/<\/span>bin<br \/>\n<br \/>\n<span class=\"sy0\">&gt;<\/span> EOF<\/div><\/div>\n<p>The following output will be shown after configuration:<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1329\" height=\"268\" class=\"wp-image-22256\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-9.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-9.png 1329w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-9-300x60.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-9-1024x206.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-9-768x155.png 768w\" sizes=\"auto, (max-width: 1329px) 100vw, 1329px\" \/><\/strong><\/p>\n<p>Then, to run the profile file named \u201c<strong>jdk21.sh<\/strong>\u201d, use the \u201c<strong>source<\/strong>\u201d command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw3\">source<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>profile.d<span class=\"sy0\">\/<\/span>jdk21.sh<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1402\" height=\"113\" class=\"wp-image-22261\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-10.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-10.png 1402w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-10-300x24.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-10-1024x83.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-10-768x62.png 768w\" sizes=\"auto, (max-width: 1402px) 100vw, 1402px\" \/><\/p>\n<h3><strong>Step 6: Check the Java Version<\/strong><\/h3>\n<p>To confirm the installation of Java in Ubuntu, the user needs to verify by checking the Java version using the given command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">java<\/span> <span class=\"re5\">-version<\/span><\/div><\/div>\n<p>This can be observed that the latest Java version has been installed successfully:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1392\" height=\"219\" class=\"wp-image-22263\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-11.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-11.png 1392w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-11-300x47.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-11-1024x161.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-11-768x121.png 768w\" sizes=\"auto, (max-width: 1392px) 100vw, 1392px\" \/><\/p>\n<h2><strong>Bonus Tip: How to Uninstall Java in Ubuntu 22.04?<\/strong><\/h2>\n<p>Sometimes a user wants to uninstall Java for some reason including freeing up space, no more need. For the need to uninstall Java in Ubuntu, follow the below-listed steps:<\/p>\n<ul>\n<li>Verify Java Version<\/li>\n<li>Detect the Location of Java Packages<\/li>\n<li>Remove Directory from Java<\/li>\n<li>Confirm Uninstallation of Java Version<\/li>\n<\/ul>\n<h3><strong>Step 1: Verify Java Version<\/strong><\/h3>\n<p>The need to verify the Java version is to know about the current status of it either already installed or not. The first step for uninstalling Java is to verify the version by using the given command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">java<\/span> <span class=\"re5\">--version<\/span><\/div><\/div>\n<p>The below output shows the installed version of Java:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1524\" height=\"174\" class=\"wp-image-22267\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-12.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-12.png 1524w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-12-300x34.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-12-1024x117.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-12-768x88.png 768w\" sizes=\"auto, (max-width: 1524px) 100vw, 1524px\" \/><\/p>\n<h3><strong>Step 2: Detect the Location of Java Packages<\/strong><\/h3>\n<p>Mostly, packages of Java are present in the \/opt\/ directory or the \/usr\/lib\/ directory. To detect the location of Java packages following command should be used:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">ls<\/span> <span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>lib<span class=\"sy0\">\/<\/span>jvm<\/div><\/div>\n<p>Utilizing the above command, we will get the directories from Java\u2019s current location:<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1526\" height=\"139\" class=\"wp-image-22270\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-13.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-13.png 1526w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-13-300x27.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-13-1024x93.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-13-768x70.png 768w\" sizes=\"auto, (max-width: 1526px) 100vw, 1526px\" \/><\/strong><\/p>\n<h3><strong>Step 3: Remove Directory from Java<\/strong><\/h3>\n<p>After identifying the location of Java packages, the user has to remove that directory by utilizing the \u201c<strong>remove<\/strong>\u201d command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">rm<\/span> <span class=\"re5\">-r<\/span> <span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>lib<span class=\"sy0\">\/<\/span>jvm<\/div><\/div>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1526\" height=\"119\" class=\"wp-image-22273\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-14.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-14.png 1526w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-14-300x23.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-14-1024x80.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-14-768x60.png 768w\" sizes=\"auto, (max-width: 1526px) 100vw, 1526px\" \/><\/strong><\/p>\n<h3><strong>Step 4: Confirm Uninstallation of Java\u2019s Version<\/strong><\/h3>\n<p>Again, recheck the Java version to verify the removal of a directory from Java using the \u201c<strong>version<\/strong>\u201d command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">java<\/span> <span class=\"re5\">--version<\/span><\/div><\/div>\n<p>The output confirms Java directory removal.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1533\" height=\"165\" class=\"wp-image-22275\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-15.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-15.png 1533w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-15-300x32.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-15-1024x110.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22209-15-768x83.png 768w\" sizes=\"auto, (max-width: 1533px) 100vw, 1533px\" \/><\/p>\n<p>We have explained the efficient methods to install Java in Ubuntu 22.04.<\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>To download\/install Java in Ubuntu 22.04 via <strong>OpenJDK18<\/strong> method, utilize either the\u201c<strong>$ sudo apt install -y openjdk-18-jdk<\/strong>\u201d or \u201c<strong>$ sudo apt install -y openjdk-18-jre<\/strong>\u201d command. Alternatively, Java can be installed via <strong>Java Development SE Kit 21 <\/strong>method<strong>. <\/strong>This can be done by using the <a href=\"https:\/\/www.oracle.com\/java\/technologies\/downloads\/#java18\">official website<\/a> along with the help of the \u201c<strong>$ sudo apt install .\/jdk-18_linux-x64_bin.deb<\/strong>\u201d command. This article has demonstrated the methods to Install Java in Ubuntu 22.04.<\/p>","protected":false},"excerpt":{"rendered":"<p>To Install Java in Ubuntu 22.04 via OpenJDK18 method, use either the \u201c$ sudo apt install -y openjdk-18-jdk\u201d or \u201c$ sudo apt install -y openjdk-18-jre\u201d command.<\/p>","protected":false},"author":110,"featured_media":22313,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-22209","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/22209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=22209"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/22209\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/22313"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=22209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=22209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=22209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}