LinuxにOracleのJDKをインストールしたときのメモ
Linux(OpenSUSE 11.4 64bit)にOracleのJDKをインストールしたときのメモ。
インストール
http://java.sun.com/javase/ja/6/download.html からJDKをダウンロードする。
$ chmod +x jdk-6u24-linux-x64-rpm.bin $ sudo ./jdk-6u24-linux-x64-rpm.bin $ # 途中エンターキーを押す必要がある
update-alternativesの設定
$ sudo update-alternatives --install /usr/bin/java java /usr/java/latest/bin/java 30000 \ --slave /usr/bin/javac javac /usr/java/latest/bin/javac \ --slave /usr/bin/keytool keytool /usr/java/latest/bin/keytool \ --slave /usr/bin/javaws javaws /usr/java/latest/bin/javaws \ --slave /usr/bin/orbd orbd /usr/java/latest/bin/orbd \ --slave /usr/bin/pack200 pack200 /usr/java/latest/bin/pack200 \ --slave /usr/bin/rmid rmid /usr/java/latest/bin/rmid \ --slave /usr/bin/rmiregistry rmiregistry /usr/java/latest/bin/rmiregistry \ --slave /usr/bin/servertool servertool /usr/java/latest/bin/servertool \ --slave /usr/bin/tnameserv tnameserv /usr/java/latest/bin/tnameserv \ --slave /usr/bin/unpack200 unpack200 /usr/java/latest/bin/unpack200 \ --slave /usr/bin/jar jar /usr/java/latest/bin/jar \ --slave /usr/bin/jarsigner jarsigner /usr/java/latest/bin/jarsigner \ --slave /etc/alternatives/java_sdk java_sdk /usr/java/latest $ sudo update-alternatives --config java There are 3 alternatives which provide `java'. Selection Alternative ----------------------------------------------- * 1 /usr/lib64/jvm/jre-1.6.0-openjdk/bin/java 2 /usr/lib64/jvm/jre-1.5.0-gcj/bin/java + 3 /usr/java/latest/bin/java Press enter to keep the default[*], or type selection number: 3 # <= /usr/java/latest/bin/javaを選択する
確認
$ java -version java version "1.6.0_24" Java(TM) SE Runtime Environment (build 1.6.0_24-b07) Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode) $ ls -l $JAVA_HOME lrwxrwxrwx 1 root root 26 6月 13 19:24 /usr/lib64/jvm/java -> /etc/alternatives/java_sdk $ ls -l /etc/alternatives/java_sdk lrwxrwxrwx 1 root root 16 6月 14 13:10 /etc/alternatives/java_sdk -> /usr/java/latest