{"id":154,"date":"2005-10-04T13:36:40","date_gmt":"2005-10-04T13:36:40","guid":{"rendered":"http:\/\/www.bartbusschots.ie\/blog\/?p=154"},"modified":"2014-08-04T20:45:16","modified_gmt":"2014-08-04T20:45:16","slug":"the-correct-way-to-install-sun-java-on-debianubuntu","status":"publish","type":"post","link":"https:\/\/www.bartbusschots.ie\/s\/2005\/10\/04\/the-correct-way-to-install-sun-java-on-debianubuntu\/","title":{"rendered":"The CORRECT way to install Sun Java on Debian\/Ubuntu"},"content":{"rendered":"<p><\/p>\n<p>This little guide is just a greatly padded out version of instructions I got from <a href=\"http:\/\/www.cs.nuim.ie\/staff\/staffmember.php?staffid=101\" title=\"Misha's Home Page\">Misha<\/a> but since we have quite a few <a href=\"http:\/\/www.ubuntulinux.org\/\" title=\"Ubuntu Linux Home Page\">Ubuntu<\/a> users and quite a few Java programmers in <a href=\"http:\/\/www.minds.nuim.ie\" title=\"MiNDS&amp;gt; Home Page\">MiNDS&amp;gt;<\/a> this should come in quite useful.<\/p>\n<p>Basically this is the Debian way of installing the Sun JSDK so that it can be managed with <font face=\"courier new,courier,monospace\">dpkg<\/font> and hence easily upgraded or removed at a later date.<\/p>\n<p>Firstly, since Ubuntu IS a distribution of <a href=\"http:\/\/www.debian.org\/\" title=\"Debian Home Page\">Debian<\/a> really I will just refer to Debian in these instructions but the instructions also apply to Ubuntu and in fact it was on Ubuntu that I tested this. Also, these instructions assume that you are logged in as a user who has access to root via <font face=\"courier new,courier,monospace\">sudo<\/font>.<\/p>\n<p>The way this will work is that we will use a Debian package called <font face=\"courier new,courier,monospace\">java-package<\/font> to turn the binary Linux installer we get from Sun (or IBM and others too) into a proper Debian package (<font face=\"courier new,courier,monospace\">.deb<\/font>) and then we will use Debian&#8217;s package manager (<font face=\"courier new,courier,monospace\">dpkg<\/font>) to install that Debian package.<\/p>\n<p>The first step in the process is to install the <font face=\"courier new,courier,monospace\">java-package<\/font> program that will allow us to create the <font face=\"courier new,courier,monospace\">.deb<\/font> file. To do this simply type:<\/p>\n<pre>sudo apt-get install java-package<\/pre>\n<p>If you are asked for a password it is for <font face=\"courier new,courier,monospace\">sudo<\/font> and you should enter your own login password.<\/p>\n<p>The next step is to go to <font face=\"courier new,courier,monospace\">java.sun.com<\/font> and download the Linux binary installer for the JSDK that you want to install. DO NOT DOWNLOAD THE LINUX RPM FILE!<\/p>\n<p>The next step is to use <font face=\"courier new,courier,monospace\">java-package<\/font> to turn this binary file into a Debian package, to do this move into the folder where you downloaded the binary file from <font face=\"courier new,courier,monospace\">java.sun.com<\/font>. <\/p>\n<p><i>NOTE, if you are doing this in the college on your machine for your 4th year project you will have to copy the binary file to<font face=\"courier new,courier,monospace\"> \/tmp<\/font> and work from there because local root does not have access to your NFS mounted home directory.<\/i><\/p>\n<p>For this step you will need <font face=\"courier new,courier,monospace\">fakeroot<\/font>, if you don&#8217;t have it installed install it with <font face=\"courier new,courier,monospace\">apt-get<\/font> like so:<\/p>\n<pre>sudo apt-get install fakeroot<\/pre>\n<p>Once you have <font face=\"courier new,courier,monospace\">fakeroot<\/font> installed and you are in the right directory start the packaging with the command (replacing <font face=\"courier new,courier,monospace\">file_from_sun.bin<\/font> with the actual name of the file you got from Sun):<\/p>\n<pre>fakeroot make-jpkg file_from_sun.bin<\/pre>\n<p>This will now appear to run the Sun installer but rather than installing it into your system it is extracting it to a temporary fake root file system and then creating the <font face=\"courier new,courier,monospace\">.deb<\/font> file from the files in that fake file system. During this stage you will be asked to agree to the Java license agreement.<\/p>\n<p>When the above command completes (will take a few minutes) a <font face=\"courier new,courier,monospace\">.deb<\/font> file will have been created in your current folder. This is the file that we will now install with <font face=\"courier new,courier,monospace\">dpkg<\/font> as follows (replacing <font face=\"courier new,courier,monospace\">name_of_deb_file.deb<\/font> with the actual name of the <font face=\"courier new,courier,monospace\">.deb<\/font> file created):<\/p>\n<pre>sudo dpkg -i name_of_deb_file.deb<\/pre>\n<p>And hey presto you are finished, when ever you want to get rid of that JDK all you have to do is (replacing <font face=\"courier new,courier,monospace\">name_of_deb_file_without_The_extension<\/font> with the name of the generated <font face=\"courier new,courier,monospace\">.deb<\/font> file but with the <font face=\"courier new,courier,monospace\">.deb<\/font> extension left out, e.g. <font face=\"courier new,courier,monospace\">sun-j2sdk1.5<\/font>):<\/p>\n<pre>dpkg --purge name_of_deb_file_without_The_extension<\/pre>\n<p>You can then install a new JSDK in the same was as described above or just leave your system Java free (heaven knows why you&#8217;d do something mad like that!)<\/p>\n<p \/>\n","protected":false},"excerpt":{"rendered":"<p>This little guide is just a greatly padded out version of instructions I got from Misha but since we have quite a few Ubuntu users and quite a few Java programmers in MiNDS&amp;gt; this should come in quite useful. Basically this is the Debian way of installing the Sun JSDK so that it can be [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[12,446],"tags":[487,5,412,408,458,488],"series":[],"class_list":["post-154","post","type-post","status-publish","format-standard","hentry","category-computers-tech","category-sysadmin","tag-debian","tag-java","tag-linux","tag-open-source","tag-tutorial","tag-ubuntu"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7t9xK-2u","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/posts\/154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/comments?post=154"}],"version-history":[{"count":1,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/posts\/154\/revisions"}],"predecessor-version":[{"id":7675,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/posts\/154\/revisions\/7675"}],"wp:attachment":[{"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/media?parent=154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/categories?post=154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/tags?post=154"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/series?post=154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}