{"id":441,"date":"2015-07-28T01:11:44","date_gmt":"2015-07-27T19:41:44","guid":{"rendered":"http:\/\/itechgenie.com\/myblog\/?p=441"},"modified":"2015-07-28T02:33:54","modified_gmt":"2015-07-27T21:03:54","slug":"installing-oracle-jdk-in-amazon-aws-ec2-ubuntu","status":"publish","type":"post","link":"https:\/\/itechgenie.com\/myblog\/2015\/07\/installing-oracle-jdk-in-amazon-aws-ec2-ubuntu\/","title":{"rendered":"Installing Oracle JDK in Amazon AWS EC2 Ubuntu"},"content":{"rendered":"<p>Lately I tried to install Oracle JDK in one of my Ubuntu servers on Amazon EC2 instance. Unfortunately the inbuilt installers support the installation of OpenJDK. <\/p>\n<p>For some requirements, I was in need of installing a specific version of JDK and test my application, you could get the older version from <a href=\"http:\/\/www.oracle.com\/technetwork\/java\/javase\/downloads\/jdk7-downloads-1880260.html\" title=\"Oracle JDK Archives\" target=\"_blank\">Oracle Site<\/a>. I used the following script from one of the blogs, hope it helps someone. <\/p>\n<pre class=\"lang:sh decode:true \" title=\"Download Oracle JDK  script\" >#!\/usr\/bin\/env bash\r\nwget -O 'jdk-7u80-linux-x64.tar.gz' --no-cookies --no-check-certificate --header 'Cookie:gpw_e24=http:\/\/www.oracle.com; oraclelicense=accept-securebackup-cookie' 'http:\/\/download.oracle.com\/otn-pub\/java\/jdk\/7u80-b15\/jdk-7u80-linux-x64.tar.gz'\r\ntar -xvf jdk-7u80-linux-x64.tar.gz\r\nsudo mkdir \/usr\/lib\/jvm\r\nsudo mv .\/jdk1.7* \/usr\/lib\/jvm\/jdk1.7.0\r\nsudo update-alternatives --install \"\/usr\/bin\/java\" \"java\" \"\/usr\/lib\/jvm\/jdk1.7.0\/bin\/java\" 1\r\nsudo update-alternatives --install \"\/usr\/bin\/javac\" \"javac\" \"\/usr\/lib\/jvm\/jdk1.7.0\/bin\/javac\" 1\r\nsudo update-alternatives --install \"\/usr\/bin\/javaws\" \"javaws\" \"\/usr\/lib\/jvm\/jdk1.7.0\/bin\/javaws\" 1\r\nsudo chmod a+x \/usr\/bin\/java\r\nsudo chmod a+x \/usr\/bin\/javac\r\nsudo chmod a+x \/usr\/bin\/javaws<\/pre>\n<p>The Key here is Oracle need you to accept the license terms before using the any version of Oracle JDK. You could do the same from the scripting by just adding <code> --no-cookies --no-check-certificate --header 'Cookie:gpw_e24=http:\/\/www.oracle.com; oraclelicense=accept-securebackup-cookie' <\/code> params to the <code>WGET<\/code>. <\/p>\n<p>Alternative, you could download the installers\/zip files from external CDNs, like <a href=\"https:\/\/www.reucon.com\/cdn\/java\/\" title=\"Reucon\" target=\"_blank\">REUCON<\/a>, move it to EC2 instance through SFTP and install it. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lately I tried to install Oracle JDK in one of my Ubuntu servers on Amazon EC2 instance. Unfortunately the inbuilt installers support the installation of OpenJDK. For some requirements, I was in need of installing a specific version of JDK and test my application, you could get the older version from Oracle Site. I used &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/itechgenie.com\/myblog\/2015\/07\/installing-oracle-jdk-in-amazon-aws-ec2-ubuntu\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Installing Oracle JDK in Amazon AWS EC2 Ubuntu&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","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":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5,73,9,12],"tags":[75,76,77,74,78,72,81,80,79],"class_list":["post-441","post","type-post","status-publish","format-standard","hentry","category-how-to","category-shell-script","category-snippets","category-utility","tag-amazon","tag-aws","tag-ec2","tag-jdk","tag-openjdk","tag-oracle","tag-scripting","tag-shell","tag-ubuntu"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2HHtz-77","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/posts\/441","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/comments?post=441"}],"version-history":[{"count":4,"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/posts\/441\/revisions"}],"predecessor-version":[{"id":445,"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/posts\/441\/revisions\/445"}],"wp:attachment":[{"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/media?parent=441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/categories?post=441"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itechgenie.com\/myblog\/wp-json\/wp\/v2\/tags?post=441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}