{"id":55856,"date":"2020-05-14T17:00:02","date_gmt":"2020-05-14T21:00:02","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/?p=55856"},"modified":"2021-08-16T15:37:48","modified_gmt":"2021-08-16T19:37:48","slug":"how-to-install-java-on-ubuntu","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/","title":{"rendered":"How to Install Java on Ubuntu"},"content":{"rendered":"\n<p><strong>Java<\/strong> is a general-purpose programming language that can be used to develop a wide variety of applications. In order to start developing with Java or installing programs that require the <strong>Java Runtime Environment (JRE)<\/strong> to operate, you must first install Java and the <strong>Java Development Kit (JDK)<\/strong>. As this process differs depending on your operating system, this article will focus on installing Java on <strong>Ubuntu<\/strong> via the <strong>command-line interface<\/strong> <strong>(CLI)<\/strong>. For CentOS 7 users, please refer to <a href=\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/vps-hosting\/install-java-on-centos\/\">this article<\/a>.\u00a0<\/p>\n\n\n\n<p>Topics Include:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"#install\">Installing Java<\/a><\/li><li><a href=\"#jdk\">Installing Java Development Kit (JDK)<\/a><\/li><\/ul>\n\n\n\n<p class=\"alert alert-info\">Install Java on your <a href=\"https:\/\/www.inmotionhosting.com\/dedicated-servers\">Dedicated Hosting<\/a> server and start developing today!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"install\">Installing Java<\/h2>\n\n\n\n<p>In order to run Java-based software on your machine, you must first install the Java Runtime Environment. Installing the JRE will require use of the standard Ubuntu commands <strong>apt<\/strong> and <strong>apt-get<\/strong> to download and install the necessary software packages.&nbsp;<\/p>\n\n\n\n<ul class=\"article_list wp-block-list\"><li>Before installing Java, you will first want to check to see if it is already installed. To do this, run the following command:<br><br><pre>java -version<\/pre><\/li><li>If it is not already installed, you can install Java with the following command:<br><br><pre>sudo apt-get install -y default-jre<\/pre><\/li><li>Once the installation has finished, you can verify the installation with the following command:<br><br><pre>java -version<\/pre><\/li><li>If the installation was successful, the output should look something like this:<br><br><pre>openjdk version \"1.8.0_252\"<br>OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~16.04-b09)<br>OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)<\/pre><\/li><\/ul>\n\n\n\n<p>Congratulations, you have now installed Java!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"jdk\">Installing the Java Development Kit (JDK)<\/h2>\n\n\n\n<p>If you are looking to use Java for development purposes, you will first need to install the Java Development Kit, which contains all of the necessary software required for developing Java-based applications.<\/p>\n\n\n\n<ul class=\"article_list wp-block-list\"><li>To install the JDK, use the following command:<br><br><pre>sudo apt install default-jdk<\/pre><\/li><li>Once the installation has finished, you can verify that installation with the following command:<br><br><pre>javac -version<\/pre><\/li><li>If the installation was successful, the output should look as follows:<br><br><pre>javac 1.8.0_252<\/pre><\/li><\/ul>\n\n\n\n<p>Congratulations, you are now prepared to start developing with Java on your Ubuntu machine!&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java is a general-purpose programming language that can be used to develop a wide variety of applications. In order to start developing with Java or installing programs that require the Java Runtime Environment (JRE) to operate, you must first install Java and the Java Development Kit (JDK). As this process differs depending on your operating<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/\"> Read More ><\/a><\/p>\n","protected":false},"author":57014,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4360],"tags":[],"class_list":["post-55856","post","type-post","status-publish","format-standard","hentry","category-software"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Install Java on Ubuntu | InMotion Hosting Support Center<\/title>\n<meta name=\"description\" content=\"This article will outline how to quickly install Java and the Java Development Kit on Ubuntu using the command-line interface.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install Java on Ubuntu | InMotion Hosting Support Center\" \/>\n<meta property=\"og:description\" content=\"This article will outline how to quickly install Java and the Java Development Kit on Ubuntu using the command-line interface.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-14T21:00:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-16T19:37:48+00:00\" \/>\n<meta name=\"author\" content=\"InMotion Hosting Contributor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InMotion Hosting Contributor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/\"},\"author\":{\"name\":\"InMotion Hosting Contributor\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644\"},\"headline\":\"How to Install Java on Ubuntu\",\"datePublished\":\"2020-05-14T21:00:02+00:00\",\"dateModified\":\"2021-08-16T19:37:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/\"},\"wordCount\":302,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Software\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/\",\"name\":\"How to Install Java on Ubuntu | InMotion Hosting Support Center\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2020-05-14T21:00:02+00:00\",\"dateModified\":\"2021-08-16T19:37:48+00:00\",\"description\":\"This article will outline how to quickly install Java and the Java Development Kit on Ubuntu using the command-line interface.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install Java on Ubuntu\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644\",\"name\":\"InMotion Hosting Contributor\",\"description\":\"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!\",\"sameAs\":[\"https:\/\/www.linkedin.com\/company\/inmotion-hosting\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/inmotion-hosting-contributor\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install Java on Ubuntu | InMotion Hosting Support Center","description":"This article will outline how to quickly install Java and the Java Development Kit on Ubuntu using the command-line interface.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/","og_locale":"en_US","og_type":"article","og_title":"How to Install Java on Ubuntu | InMotion Hosting Support Center","og_description":"This article will outline how to quickly install Java and the Java Development Kit on Ubuntu using the command-line interface.","og_url":"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2020-05-14T21:00:02+00:00","article_modified_time":"2021-08-16T19:37:48+00:00","author":"InMotion Hosting Contributor","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"InMotion Hosting Contributor","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/"},"author":{"name":"InMotion Hosting Contributor","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644"},"headline":"How to Install Java on Ubuntu","datePublished":"2020-05-14T21:00:02+00:00","dateModified":"2021-08-16T19:37:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/"},"wordCount":302,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Software"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/","url":"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/","name":"How to Install Java on Ubuntu | InMotion Hosting Support Center","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2020-05-14T21:00:02+00:00","dateModified":"2021-08-16T19:37:48+00:00","description":"This article will outline how to quickly install Java and the Java Development Kit on Ubuntu using the command-line interface.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/software\/how-to-install-java-on-ubuntu\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Install Java on Ubuntu"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644","name":"InMotion Hosting Contributor","description":"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!","sameAs":["https:\/\/www.linkedin.com\/company\/inmotion-hosting\/","https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/inmotion-hosting-contributor\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/55856","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/57014"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=55856"}],"version-history":[{"count":17,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/55856\/revisions"}],"predecessor-version":[{"id":82922,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/55856\/revisions\/82922"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=55856"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=55856"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=55856"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}