{"id":1016,"date":"2016-10-18T20:20:01","date_gmt":"2016-10-18T18:20:01","guid":{"rendered":"http:\/\/hobbykeller.spdns.de\/?p=1016"},"modified":"2016-10-18T20:41:53","modified_gmt":"2016-10-18T18:41:53","slug":"installing-oracle-java-on-manjaro-arch","status":"publish","type":"post","link":"https:\/\/hobbykeller.spdns.de\/?p=1016","title":{"rendered":"Installing Oracle Java on Manjaro \/ Arch"},"content":{"rendered":"<p>Linux distributions normally ship with the OpenJDK Java. Anyone who has ever tried to develop in Java will come to a point, where it is difficult to get around Oracle&#8217;s official Java installation. So there are several questions connected to Java: (1) Do I need the JRE, the JDK or both? (2) How can I install Oracle Java on my Arch \/ Manjaro machine? (3) Do I have to remove the OpenJDK java?<\/p>\n<p><!--more--><\/p>\n<h1>JRE or JDK or both?<\/h1>\n<p>If you are not going to develop in Java, the JRE is enough. JRE is the the &#8220;Java Virtual Machine&#8221; which translates the precompiled Java byte code into instructions which your particular OS environment will understand. Running online applets which have been embedded into HTML code requires such a JRE. In the past, I often had problems with banking applications run under OpenJDK so that there was virtually no way around Oracle&#8217;s jre. Today, though, OpenJDK seems to have come a long way and even applications as exposed as <a href=\"http:\/\/webgui.eurexchange.com\" target=\"_blank\" class=\"broken_link\">Eurex Trader<\/a> are running without problems under OpenJDK&#8217;s IcedTea JRE.<\/p>\n<p>Only if you are going to develop your own Java applications, you will need the JDK &#8211; and my experience from the past is that it is preferable to use Oracle&#8217;s Java by default.<\/p>\n<p>In case you go for the JDK, the question is: Do I still need the JRE on top?<\/p>\n<p>According <a href=\"https:\/\/forum.manjaro.org\/t\/oracle-java-installation\/2746\/9\" target=\"_blank\" class=\"broken_link\">to this post<\/a>, the answer is clearly &#8220;No, you don&#8217;t.&#8221;. This is because the JDK already includes the corresponding Java Runtime Environment:<\/p>\n<blockquote><p>jdk contains jre. but you can consider install jdk-docs as well<\/p>\n<p>&nbsp;<\/p><\/blockquote>\n<h1>Installing the Java SDK on your Manjaro \/ Arch machine<\/h1>\n<p>You can either use the pacman gui or go for the console based <code>yaourt<\/code> installation. I am going to show how to install with <code>yaourt<\/code>. At your command prompt, issue<\/p>\n<pre class=\"lang:default decode:true \" title=\"Launching console-based yaourt installation\">[user@manjaro ~]$ yaourt jdk<\/pre>\n<p><code>yaourt<\/code> will respondd with a flurry of output that looks like this:<\/p>\n<figure id=\"attachment_1017\" aria-describedby=\"caption-attachment-1017\" style=\"width: 819px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1017\" src=\"http:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2016\/10\/yaourt-results.png\" alt=\"Installation candidates suggested by yaourt\" width=\"819\" height=\"506\" srcset=\"https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2016\/10\/yaourt-results.png 819w, https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2016\/10\/yaourt-results-300x185.png 300w, https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2016\/10\/yaourt-results-768x474.png 768w, https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2016\/10\/yaourt-results-486x300.png 486w\" sizes=\"auto, (max-width: 819px) 100vw, 819px\" \/><figcaption id=\"caption-attachment-1017\" class=\"wp-caption-text\">Installation candidates suggested by yaourt<\/figcaption><\/figure>\n<p>Here is how to read that output:<\/p>\n<ul>\n<li>things marked in red are deprecated versions, which you should not install unless there is a compelling reason;<\/li>\n<li>the fields in blue are the &#8220;votes&#8221; which were given for the package &#8211; you can use them as a proxy for what should be installed if you are unsure what to pick;<\/li>\n<li>the fields in yellow are a popularity index &#8211; no idea how this is computed but it should have roughly the same meaning as the votes<\/li>\n<\/ul>\n<p>Based on these number of votes, it is easy to asses which installation to pick: number 21 with more than 700 votes is the current Oracle Java SDK this is version jdk 8u102-1. There is a more recent version of Oracle Java 9, though &#8211; but this has not been officially released by Oracle and still is in the state of a development snapshot. So<\/p>\n<h1>OpenJDK and Oracle Java on the same machine?<\/h1>\n<p>I had some trouble when I tried to install Oracle Java alongside Ubuntu&#8217;s default OpenJDK in the past. According the discussion linked above, however, having both JDKs on the same machine works without problems:<\/p>\n<blockquote><p>In fact you don&#8217;t need to remove open jdk, in your system, the oracle jdk and open jdk can [&#8230;] exist at the same time.<\/p><\/blockquote>\n<p>The tricky question then is: How can I &#8220;switch&#8221; between the jdks? On Arch Linux this is really easy thanks to the archlinux-java command. You can enquire, which Java version is currently activated by default and (given root privileges) change the default setting:<\/p>\n<pre class=\"lang:default decode:true \" title=\"Setting the default java environment with archlinux-java\">[user@manjaro ~]$ archlinux-java status\r\nAvailable Java environments:\r\n  java-8-jdk\r\n  java-8-openjdk\/jre (default)\r\n[user@manjaro ~]$ sudo archlinux-java set java-8-jdk\r\n[sudo] password for user: \r\n[user@manjaro ~]$ archlinux-java status\r\nAvailable Java environments:\r\n  java-8-jdk (default)\r\n  java-8-openjdk\/jre\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux distributions normally ship with the OpenJDK Java. Anyone who has ever tried to develop in Java will come to a point, where it is difficult to get around Oracle&#8217;s<span class=\"more-button\"><a href=\"https:\/\/hobbykeller.spdns.de\/?p=1016\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Installing Oracle Java on Manjaro \/ Arch<\/span><\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64],"tags":[220,192,224,225,221,223,222,226],"class_list":["post-1016","post","type-post","status-publish","format-standard","hentry","category-linux","tag-arch","tag-java","tag-jdk","tag-jre","tag-manajro","tag-openjdk","tag-oracle","tag-yaourt"],"_links":{"self":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1016","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1016"}],"version-history":[{"count":3,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1016\/revisions"}],"predecessor-version":[{"id":1021,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1016\/revisions\/1021"}],"wp:attachment":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}