Install Oracle Sun Java SDK 7 u5 di OpenSuSE 12.1

Sebenernya OpenSuSE telah menyertakan java versi openjdk, tapi kalau kita mau menggunakan aplikasi (salah satunya) netbeans, yang diminta java yang versi Sun Java SDK. Bingung juga sih cara install-nya, sedikit browsing dan ketemulah beberapa website yang membahas cara install-nya (di-switch) Sun JDK. Saat tulisan ini ditulis, JDK versi 7 update 5 yang bisa di download di sini. Kebetulan saya menggunakan OpenSuSE 12.1 x86_64, tentu saja yang di download yang versi Linux 64bit, ambil aja yang rpm.

      1. Cek dulu versi java yang telah ter-install di OS kita

        gatoti@bunglon:/data/prog-linux> java -version
        java version "1.5.0"
        gij (GNU libgcj) version 4.6.2

        Copyright (C) 2007 Free Software Foundation, Inc.
        This is free software; see the source for copying conditions.  There is NO
        warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

      2. Lalu install paket rpm yang sudah di-download

        gatoti@bunglon:/data/prog-linux> sudo rpm -ivh jdk-7u5-linux-x64.rpm
        root's password:
        Preparing...                ########################################### [100%]
        1:jdk                    ########################################### [100%]
        Unpacking JAR files...
        rt.jar...
        jsse.jar...
        charsets.jar...
        tools.jar...
        localedata.jar...

      3. Lalu cek lagi versi java yang sudah kita install, kalau masih seperti di bawah ini, maka belum ter-install dengan benar

        gatoti@bunglon:/data/prog-linux> java -version
        java version "1.5.0"
        gij (GNU libgcj) version 4.6.2
        Copyright (C) 2007 Free Software Foundation, Inc.
        This is free software; see the source for copying conditions.  There is NO
        warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

      4. Langkah selanjutnya kita switch ke Sun JDK 7

        gatoti@bunglon:/data/prog-linux> sudo /usr/sbin/update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk1.7.0_05/bin/java" 40

      5. Lalu browser plugin nya juga

        gatoti@bunglon:/data/prog-linux> sudo /usr/sbin/update-alternatives --install "/usr/lib64/browser-plugins/javaplugin.so" "javaplugin" "/usr/java/jdk1.7.0_05/jre/lib/amd64/libnpjp2.so" 40
        root's password:
        update-alternatives: renaming javaplugin link from /usr/lib/browser-plugins/javaplugin.so to /usr/lib64/browser-plugins/javaplugin.so.

      6. Konfigurasi alternatives java-nya

        gatoti@bunglon:/data/prog-linux> sudo /usr/sbin/update-alternatives --config java
        There are 2 choices for the alternative java (providing /usr/bin/java).
        Selection    Path                                   Priority   Status
        ------------------------------------------------------------
        0            /usr/lib64/jvm/jre-1.5.0-gcj/bin/java   1500      auto mode
        1            /usr/java/jdk1.7.0_05/bin/java          40        manual mode
        2            /usr/lib64/jvm/jre-1.5.0-gcj/bin/java   1500      manual mode
        Press enter to keep the current choice[*], or type selection number: 1
        update-alternatives: using /usr/java/jdk1.7.0_05/bin/java to provide /usr/bin/java (java) in manual mode.

      7. Juga konfigurasi alternatives javaplugin-nya

        gatoti@bunglon:/data/prog-linux> sudo /usr/sbin/update-alternatives --config javaplugin
        There are 2 choices for the alternative javaplugin (providing /usr/lib64/browser-plugins/javaplugin.so).
        Selection    Path                                             Priority   Status
        ------------------------------------------------------------
        0            /usr/lib64/IcedTeaPlugin.so                       17106     auto mode
        1            /usr/java/jdk1.7.0_05/jre/lib/amd64/libnpjp2.so   40        manual mode
        2            /usr/lib64/IcedTeaPlugin.so                       17106     manual mode
        Press enter to keep the current choice[*], or type selection number: 1
        update-alternatives: using /usr/java/jdk1.7.0_05/jre/lib/amd64/libnpjp2.so to provide /usr/lib64/browser-plugins/javaplugin.so (javaplugin) in manual mode.

      8. Lalu cek lagi versi java nya

        gatoti@bunglon:/data/prog-linux> java -version
        java version "1.7.0_05"
        Java(TM) SE Runtime Environment (build 1.7.0_05-b06)
        Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)

Referensi:
http://www.freetechie.com/blog/installing-oracle-sun-java-1-7u1-opensuse-12-1/
http://itfromzerotohero.wordpress.com/2011/12/10/install-java-7-di-open-suse-12-1/
http://opensuse.or.id/panduan/aplikasi/aplikasi-development-pemrogramman/instalasi-java-pada-opensuse/