Help us understand the problem. What is going on with this article?

Amazon Linuxにjdk1.7 or 1.8インストール

More than 5 years have passed since last update.

ダウンロード&インストール

jdk8

$ wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-linux-x64.rpm"
$ sudo rpm -ivh jdk-8u25-linux-x64.rpm

jdk7

$ wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/7u72-b14/jdk-7u72-linux-x64.rpm"
$ sudo rpm -ivh jdk-7u72-linux-x64.rpm

ここからもダウンロードできます

jdk8

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

jdk7

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

インストール先

$ ll /usr/java/
total 4
lrwxrwxrwx 1 root root   16 Nov 10 15:40 default -> /usr/java/latest
drwxr-xr-x 9 root root 4096 Nov 10 15:40 jdk1.8.0_25
lrwxrwxrwx 1 root root   21 Nov 10 15:40 latest -> /usr/java/jdk1.8.0_25

バージョン指定実行コマンド作成

java8

$ sudo ln -s /usr/java/jdk1.8.0_25/bin/java /usr/bin/java8

java7

$ sudo ln -s /usr/java/jdk1.7.0_72/bin/java /usr/bin/java7

javaコマンドのリンクを変更

$ sudo rm /usr/bin/java
$ sudo ln -s /usr/bin/java8 /usr/bin/java

alternativesというのを使うといいみたいですが調べきれていません。

確認

$ java -version
java version "1.8.0_25"
lifull
日本最大級の不動産・住宅情報サイト「LIFULL HOME'S」を始め、人々の生活に寄り添う様々な情報サービス事業を展開しています。
https://lifull.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした