Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Setting sun java as dafault

  1. #1

    Default Setting sun java as dafault

    I have deleted the openjkd and the icedtea, and have installed sun's jre(jre-1.7.0_02-fcs.x86_64) and jdk(jdk-2000:1.7.0_02-fcs.x86_64), but the system(opensuse 12.1, 64bit), doesn't recognize them, after searching I came up with commands that are for Fedora:

    alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/default/lib/amd64/libnpjp2.so 20000
    alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/default/jre/lib/amd64/libnpjp2.so 20000

    cat <<EOF>> /etc/profile.d/sunjava.sh
    export JAVA_HOME=/usr/java/default
    export PATH=\$JAVA_HOME/bin$PATH
    EOF



    Are there any command similar to these for opensuse?

  2. #2

    Default Re: Setting sun java as dafault

    Quote Originally Posted by kujirasan View Post
    I have deleted the openjkd and the icedtea, and have installed sun's jre(jre-1.7.0_02-fcs.x86_64) and jdk(jdk-2000:1.7.0_02-fcs.x86_64), but the system(opensuse 12.1, 64bit), doesn't recognize them, after searching I came up with commands that are for Fedora:

    alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/default/lib/amd64/libnpjp2.so 20000
    alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/default/jre/lib/amd64/libnpjp2.so 20000

    cat <<EOF>> /etc/profile.d/sunjava.sh
    export JAVA_HOME=/usr/java/default
    export PATH=\$JAVA_HOME/bin$PATH
    EOF



    Are there any command similar to these for opensuse?
    Hi,

    check that the java is installed in /usr/java/latest (which is a link to another subdir in /usr/java.

    if it is, you can use this :

    ln -sf /usr/java/latest/bin/javac /etc/alternatives/javac
    ln -sf /usr/java/latest/bin/javah /etc/alternatives/javah
    ln -sf /usr/java/latest/bin/javaws /etc/alternatives/javaws
    ln -sf /usr/java/latest/bin/javap /etc/alternatives/javap
    ln -sf /usr/java/latest/bin/javadoc /etc/alternatives/javadoc
    ln -sf /usr/java/latest/bin/jar /etc/alternatives/jar
    ln -sf /usr/java/latest/bin/java /etc/alternatives/java

    (copy and paste that into a file if you wish and sh it from the command line).

    HTH

    Lenwolf

  3. #3
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,378
    Blog Entries
    1

    Default Re: Setting sun java as dafault

    There is the 'update-alternatives' utility that can be used to install/switch java.

    man update-alternatives

  4. #4

    Default Re: Setting sun java as dafault

    Hi Len these are what the system shows:


    /usr/java> dir
    total 8
    lrwxrwxrwx 1 root root 16 Dec 21 05:24 default -> /usr/java/latest
    drwxr-xr-x 8 root root 4096 Dec 21 05:24 jdk1.7.0_02
    drwxr-xr-x 6 root root 4096 Dec 21 05:24 jre1.7.0_02
    lrwxrwxrwx 1 root root 21 Dec 21 05:24 latest -> /usr/java/jdk1.7.0_02

    and

    /usr/java/latest> dir
    total 19716
    drwxr-xr-x 2 root root 4096 Dec 21 05:24 bin
    -rw-r--r-- 1 root root 3339 Nov 17 16:34 COPYRIGHT
    drwxr-xr-x 4 root root 4096 Dec 21 05:24 db
    drwxr-xr-x 3 root root 4096 Dec 21 05:24 include
    drwxr-xr-x 5 root root 4096 Dec 21 05:24 jre
    drwxr-xr-x 3 root root 4096 Dec 21 05:24 lib
    -rw-r--r-- 1 root root 40 Nov 17 16:34 LICENSE
    drwxr-xr-x 4 root root 4096 Dec 21 05:24 man
    -rw-r--r-- 1 root root 114 Nov 17 16:34 README.html
    -r--r--r-- 1 root root 5374 Dec 20 08:56 register.html
    -r--r--r-- 1 root root 5671 Dec 20 08:56 register_ja.html
    -r--r--r-- 1 root root 4977 Dec 20 08:56 register_zh_CN.html
    -rw-r--r-- 1 root root 444 Nov 17 16:36 release
    -rw-r--r-- 1 root root 19945282 Nov 17 16:35 src.zip
    -rw-r--r-- 1 root root 172252 Nov 17 16:34 THIRDPARTYLICENSEREADME.txt


    the jdk and jre have to be moved to latest?

  5. #5

    Default Re: Setting sun java as dafault

    //usr/lib64/jvm # dir
    total 8
    drwxr-xr-x 3 root root 4096 Dec 20 09:02 java-1.5.0-gcj-4.6-1.5.0.0
    drwxr-xr-x 3 root root 4096 Dec 20 09:02 java-1.6.0-openjdk-1.6.0
    lrwxrwxrwx 1 root root 21 Dec 20 09:02 jre -> /etc/alternatives/jre
    lrwxrwxrwx 1 root root 27 Dec 20 09:02 jre-1.5.0 -> /etc/alternatives/jre_1.5.0
    lrwxrwxrwx 1 root root 30 Dec 20 09:02 jre-1.5.0-gcj -> java-1.5.0-gcj-4.6-1.5.0.0/jre
    lrwxrwxrwx 1 root root 25 Dec 20 09:02 jre-gcj -> /etc/alternatives/jre_gcj

  6. #6

    Default Re: Setting sun java as dafault

    Quote Originally Posted by kujirasan View Post
    Hi Len these are what the system shows:


    /usr/java> dir
    total 8
    lrwxrwxrwx 1 root root 16 Dec 21 05:24 default -> /usr/java/latest
    drwxr-xr-x 8 root root 4096 Dec 21 05:24 jdk1.7.0_02
    drwxr-xr-x 6 root root 4096 Dec 21 05:24 jre1.7.0_02
    lrwxrwxrwx 1 root root 21 Dec 21 05:24 latest -> /usr/java/jdk1.7.0_02

    and

    /usr/java/latest> dir
    total 19716
    drwxr-xr-x 2 root root 4096 Dec 21 05:24 bin
    -rw-r--r-- 1 root root 3339 Nov 17 16:34 COPYRIGHT
    drwxr-xr-x 4 root root 4096 Dec 21 05:24 db
    drwxr-xr-x 3 root root 4096 Dec 21 05:24 include
    drwxr-xr-x 5 root root 4096 Dec 21 05:24 jre
    drwxr-xr-x 3 root root 4096 Dec 21 05:24 lib
    -rw-r--r-- 1 root root 40 Nov 17 16:34 LICENSE
    drwxr-xr-x 4 root root 4096 Dec 21 05:24 man
    -rw-r--r-- 1 root root 114 Nov 17 16:34 README.html
    -r--r--r-- 1 root root 5374 Dec 20 08:56 register.html
    -r--r--r-- 1 root root 5671 Dec 20 08:56 register_ja.html
    -r--r--r-- 1 root root 4977 Dec 20 08:56 register_zh_CN.html
    -rw-r--r-- 1 root root 444 Nov 17 16:36 release
    -rw-r--r-- 1 root root 19945282 Nov 17 16:35 src.zip
    -rw-r--r-- 1 root root 172252 Nov 17 16:34 THIRDPARTYLICENSEREADME.txt


    the jdk and jre have to be moved to latest?
    Hi,

    no they don't.

    The "latest" and the "default" directories are actually not directories but just links, in this case to usr/java/jdk1.7.0_02. If you later install a new version of the Oracle jdk, the installer will not remove the "old" jdk (usr/java/jdk1.7.0_02), but will install the new one in its own directory within /usr/java. It will then modify the "latest" and "default" links to point to the newly installed jdk. This way, if you point to the "latest" (or the "default") link, you will always point to the newest Oracle jdk without having to do anything else, but the old one(s) will still be present.

    HTH

    lenwolf

  7. #7

    Default Re: Setting sun java as dafault

    Len thanks for the reply, here is a more to the point procedure and it is for opensuse 12.1, only problem in for 32 bit, not 64bit, can you or any other person familiar with opensuse post procedure for 64 bit version?

    Installing Oracle (sun) Java 1.7u1 openSUSE 12.1 | Free Techie Blog

    The one I downloaded was: jdk-7u1-linux-i586.rpm

    Install the jdk with yast2, zypper, or by double clicking the rpm within dolphin or nautilus:

    sudo zypper in jdk-7u1-linux-i586.rpm -y

    Now you have to setup the alternatives so you can use switch between Iced Tea, which is default, and the Oracle Java.

    First install the alternative:

    sudo /usr/sbin/update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk1.7.0_01/bin/java" 40

    Now install the alternative for your browser plugin:

    sudo /usr/sbin/update-alternatives --install "/usr/lib/browser-plugins/javaplugin.so" "javaplugin" "/usr/java/jdk1.7.0_01/jre/lib/i386/libnpjp2.so" 40

    Note: the first quotes are pointing to the path, the the name of the alternative script, and the 3rd is the location to point to. The numbers at the end is the priority in case it was set to automode.

    Now you have to configure the alternatives, first we’ll do java:

    sudo /usr/sbin/update-alternatives java

    Choose the number associated with /usr/java/jdk1.7.0_01/bin/java, in my case it was 1.

    Now lets configure javaplugin:

    sudo /usr/sbin/update-alternatives javaplugin

    Choose the number associated with /usr/java/jdk1.7.0_01/jre/lib/i386/libnpjp2.so, in my case it was 1.

  8. #8

    Default Re: Setting sun java as dafault

    Hi Len, thanks a lot java installed flawlessly , only problem is doing a symbolic link with Firefox, any one can help?

  9. #9

    Default Re: Setting sun java as dafault

    Quote Originally Posted by kujirasan View Post
    Hi Len, thanks a lot java installed flawlessly , only problem is doing a symbolic link with Firefox, any one can help?
    HI,

    I'm not sure I understand exactly what you want to do?
    Do you want to create a symbolic link to firefox?

    Lenwolf

  10. #10

    Default Re: Setting sun java as dafault

    Quote Originally Posted by lenwolf View Post
    HI,

    I'm not sure I understand exactly what you want to do?
    Do you want to create a symbolic link to firefox?

    Lenwolf
    yes that is the case, I tried this one


    ln -s /usr/java/<Java version>/lib/amd64/libnpjp2.so /usr/lib64/browser-plugins/libnpjp2.so


    and my java version is :

    java version "1.7.0_02"
    Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)




    so;
    [B]ln -s /usr/java/jre-1.7.0_02/lib/amd64/libnpjp2.so /usr/lib64/browser-plugins/libnpjp2.so[/B]


    But it did not work

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •