Results 1 to 4 of 4

Thread: Installing Oracle Java 9 Standard Edition.

  1. #1
    Join Date
    Aug 2008
    Location
    England
    Posts
    65

    Default Installing Oracle Java 9 Standard Edition.

    Please accept this as a starting point for installing Oracle java JDK-9 or JRE-9 with the browser plugin (now deprecated).

    Java version 9 has been substantially changed from the earlier versions and there are a few gotchas that it is best to avoid.

    This thread addresses only the Java 9 JDK and JRE Standard Edition, the Server and Enterprise editions may be entirely different. I am also addressing the 64 bit architecture.

    The root of the downloads is at: http://www.oracle.com/technetwork/ja...ads/index.html

    The rpm does not work. It puts the files into their intended places and then fails to set up the correct alternatives structures. It also places a few links into the /usr/bin folder that have to be cleared away before you set up the alternatives.

    Download the tar.gz file the name of which will change with the versions and revisions but is at present jdk-9_linux-64_bin.tar.gz - the 9 will be followed by minor version and revision numbers later.

    As super user unpack the tar file into folder /usr/java and you will have a folder with all the required content named /usr/java/jdk-9 - you may have to create folder /usr/java
    At this point it may be a good idea to follow the Oracle structures by creating two links in /usr/java to direct references to the correct place. (Why they do this I have no idea).

    As super user:
    Code:
    ln -s jdk-9 latest
    ln -s latest default
    Now it is only necessary to run two script files to set up the alternatives. Best to close browsers before running the plugin script. I have called these scripts:
    install-alternatives-oracle-jdk9.sh
    Code:
    sudo /usr/sbin/update-alternatives --install /usr/bin/javac javac /usr/java/default/bin/javac 3 \
    --slave /usr/bin/appletviewer appletviewer /usr/java/default/bin/appletviewer \
    --slave /usr/bin/jar jar /usr/java/default/bin/jar \
    --slave /usr/bin/jarsigner jarsigner /usr/java/default/bin/jarsigner \
    --slave /usr/lib64/jvm/java java_sdk /usr/java/default \
    --slave /usr/bin/javadoc javadoc /usr/java/default/bin/javadoc \
    --slave /usr/bin/javah javah /usr/java/default/bin/javah \
    --slave /usr/bin/javap javap /usr/java/default/bin/javap \
    --slave /usr/bin/javapackager javapackager /usr/java/default/bin/javapackager \
    --slave /usr/bin/jconsole jconsole /usr/java/default/bin/jconsole \
    --slave /usr/bin/jcmd jcmd /usr/java/default/bin/jcmd \
    --slave /usr/bin/jdb jdb /usr/java/default/bin/jdb \
    --slave /usr/bin/jdeprscan jdeprscan /usr/java/default/bin/jdeprscan \
    --slave /usr/bin/jdeps jdeps /usr/java/default/bin/jdeps \
    --slave /usr/bin/jinfo jinfo /usr/java/default/bin/jinfo \
    --slave /usr/bin/jlink jlink /usr/java/default/bin/jlink \
    --slave /usr/bin/jmap jmap /usr/java/default/bin/jmap \
    --slave /usr/bin/jmod jmod /usr/java/default/bin/jmod \
    --slave /usr/bin/jps jps /usr/java/default/bin/jps \
    --slave /usr/bin/jrunscript jrunscript /usr/java/default/bin/jrunscript \
    --slave /usr/bin/jshell jshell /usr/java/default/bin/jshell \
    --slave /usr/bin/jstack jstack /usr/java/default/bin/jstack \
    --slave /usr/bin/jstat jstat /usr/java/default/bin/jstat \
    --slave /usr/bin/jstatd jstatd /usr/java/default/bin/jstatd \
    --slave /usr/bin/pack200 pack200 /usr/java/default/bin/pack200 \
    --slave /usr/bin/rmic rmic /usr/java/default/bin/rmic \
    --slave /usr/bin/schemagen schemagen /usr/java/default/bin/schemagen \
    --slave /usr/bin/serialver serialver /usr/java/default/bin/serialver \
    --slave /usr/bin/unpack200 unpack200 /usr/java/default/bin/unpack200 \
    --slave /usr/bin/wsgen wsgen /usr/java/default/bin/wsgen \
    --slave /usr/bin/wsimport wsimport /usr/java/default/bin/wsimport \
    --slave /usr/bin/xjc xjc /usr/java/default/bin/xjc
    install-alternatives-oracle-jre9.sh
    Code:
    sudo /usr/sbin/update-alternatives --install /usr/bin/java java /usr/java/default/bin/java 3 \
    --slave /usr/bin/idlj idlj /usr/java/default/bin/idlj \
    --slave /usr/lib64/jvm/jre jre /usr/java/default \
    --slave /usr/bin/keytool keytool /usr/java/default/bin/keytool \
    --slave /usr/bin/orbd orbd /usr/java/default/bin/orbd \
    --slave /usr/bin/policytool policytool /usr/java/default/bin/policytool \
    --slave /usr/bin/rmid rmid /usr/java/default/bin/rmid \
    --slave /usr/bin/rmiregistry rmiregistry /usr/java/default/bin/rmiregistry \
    --slave /usr/bin/servertool servertool /usr/java/default/bin/servertool \
    --slave /usr/bin/tnameserv tnameserv /usr/java/default/bin/tnameserv
    install-alternatives-oracle-jre9-plugin.sh
    Code:
    sudo /usr/sbin/update-alternatives --install /usr/lib64/browser-plugins/javaplugin.so javaplugin /usr/java/default/lib/libnpjp2.so 10 \
    --slave /usr/bin/javaws javaws /usr/java/default/bin/javaws \
    --slave /usr/bin/jcontrol jcontrol /usr/java/default/bin/jcontrol
    You now only have to run, as super user, the update-alternatives --config commands:
    Code:
    update-alternatives --config java
    update-alternatives --config javac
    update-alternatives --config javaplugin

    If you did have previous alternatives installed then you just have to select the one you require.

    NOTE the JDK-9 has no manual pages.

    I do hope that this helps somebody.

    Please ammend, modify, extend and correct any of the above.

    Peter

  2. #2
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,462
    Blog Entries
    2

    Default Re: Installing Oracle Java 9 Standard Edition.

    Thx for posting,

    But,
    The Oracle 9 SE JDK is not supposed to be so difficult to install, and the RPM is supposed to include update-alternativds.

    Is still a mystery why the simple RPM insteall <following the Oracle Install documentation> didn't work for you, perhaps when you instead followed instructions for Oracle 8 or 7 at the SDB Java messed up your machine.

    On a brand new 42.2, I was able to install openJDK 8 and Oracle 9 SE JDK side by side without any problems following the Oracle install instructions as described in this post

    https://forums.opensuse.org/showthre...64#post2840864

    Perhaps others who are willing to try the steps I described can verify whether there is a problem or not.

    TSu
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  3. #3
    Join Date
    Aug 2008
    Location
    England
    Posts
    65

    Default Re: Installing Oracle Java 9 Standard Edition.

    Hi tsu2, thanks for following this up.
    I am bemused by why the rpm works for you but fails on my system. My system is a brand new system with Leap 42.3 as its first install.
    To try and get a handle on this I have inspected the post script in the rpm and find the alternatives rather odd, vis.
    The function in the script to set up alternatives for the JRE is:
    Code:
    alt_install_java() {
    priority=$1
    jrebindir=$2
    jremandir=$3
     /usr/sbin/alternatives --install \
     /usr/bin/java java $jrebindir/java $priority \
     --slave /usr/bin/appletviewer appletviewer $jrebindir/appletviewer --slave /usr/bin/idlj idlj $jrebindir/idlj --slave /usr/bin/javaws javaws $jrebindir/javaws --slave /usr/bin/jcontrol jcontrol $jrebindir/jcontrol --slave /usr/bin/jjs jjs $jrebindir/jjs --slave /usr/bin/jrunscript jrunscript $jrebindir/jrunscript --slave /usr/bin/jweblauncher jweblauncher $jrebindir/jweblauncher --slave /usr/bin/keytool keytool $jrebindir/keytool --slave /usr/bin/orbd orbd $jrebindir/orbd --slave /usr/bin/pack200 pack200 $jrebindir/pack200 --slave /usr/bin/rmid rmid $jrebindir/rmid --slave /usr/bin/rmiregistry rmiregistry $jrebindir/rmiregistry --slave /usr/bin/servertool servertool $jrebindir/servertool --slave /usr/bin/tnameserv tnameserv $jrebindir/tnameserv --slave /usr/bin/unpack200 unpack200 $jrebindir/unpack200
    }
    The function in the script to set up alternatives for the compiler and development tools is:
    Code:
    alt_install_javac() {
    priority=$1
    jdkbindir=$2
    jdkmandir=$3
    /usr/sbin/alternatives --install \
    /usr/bin/javac javac $jdkbindir/javac $priority \
     --slave /usr/bin/appletviewer appletviewer $jdkbindir/appletviewer --slave /usr/bin/idlj idlj $jdkbindir/idlj --slave /usr/bin/jaotc jaotc $jdkbindir/jaotc --slave /usr/bin/jar jar $jdkbindir/jar --slave /usr/bin/jarsigner jarsigner $jdkbindir/jarsigner --slave /usr/bin/javadoc javadoc $jdkbindir/javadoc --slave /usr/bin/javah javah $jdkbindir/javah --slave /usr/bin/javap javap $jdkbindir/javap --slave /usr/bin/javapackager javapackager $jdkbindir/javapackager --slave /usr/bin/javaws javaws $jdkbindir/javaws --slave /usr/bin/jcmd jcmd $jdkbindir/jcmd --slave /usr/bin/jconsole jconsole $jdkbindir/jconsole --slave /usr/bin/jcontrol jcontrol $jdkbindir/jcontrol --slave /usr/bin/jdb jdb $jdkbindir/jdb --slave /usr/bin/jdeprscan jdeprscan $jdkbindir/jdeprscan --slave /usr/bin/jdeps jdeps $jdkbindir/jdeps --slave /usr/bin/jhsdb jhsdb $jdkbindir/jhsdb --slave /usr/bin/jimage jimage $jdkbindir/jimage --slave /usr/bin/jinfo jinfo $jdkbindir/jinfo --slave /usr/bin/jjs jjs $jdkbindir/jjs --slave /usr/bin/jlink jlink $jdkbindir/jlink --slave /usr/bin/jmap jmap $jdkbindir/jmap --slave /usr/bin/jmc jmc $jdkbindir/jmc --slave /usr/bin/jmod jmod $jdkbindir/jmod --slave /usr/bin/jps jps $jdkbindir/jps --slave /usr/bin/jrunscript jrunscript $jdkbindir/jrunscript --slave /usr/bin/jshell jshell $jdkbindir/jshell --slave /usr/bin/jstack jstack $jdkbindir/jstack --slave /usr/bin/jstat jstat $jdkbindir/jstat --slave /usr/bin/jstatd jstatd $jdkbindir/jstatd --slave /usr/bin/jweblauncher jweblauncher $jdkbindir/jweblauncher --slave /usr/bin/keytool keytool $jdkbindir/keytool --slave /usr/bin/orbd orbd $jdkbindir/orbd --slave /usr/bin/pack200 pack200 $jdkbindir/pack200 --slave /usr/bin/policytool policytool $jdkbindir/policytool --slave /usr/bin/rmic rmic $jdkbindir/rmic --slave /usr/bin/rmid rmid $jdkbindir/rmid --slave /usr/bin/rmiregistry rmiregistry $jdkbindir/rmiregistry --slave /usr/bin/schemagen schemagen $jdkbindir/schemagen --slave /usr/bin/serialver serialver $jdkbindir/serialver --slave /usr/bin/servertool servertool $jdkbindir/servertool --slave /usr/bin/tnameserv tnameserv $jdkbindir/tnameserv --slave /usr/bin/unpack200 unpack200 $jdkbindir/unpack200 --slave /usr/bin/wsgen wsgen $jdkbindir/wsgen --slave /usr/bin/wsimport wsimport $jdkbindir/wsimport --slave /usr/bin/xjc xjc $jdkbindir/xjc
    }
    And they are called from only one place in the script:
    Code:
        #
        # Register alternatives for java for jre and javac for jdk
        #
        if [ -x /usr/sbin/alternatives ]; then
            if [ 1 = 1 ]; then
                INSTALL_JDK_PATH=${RPM_INSTALL_PREFIX}/jdk-9
                alt_install_java 9`printf "%02u%02u%03u" 0 0 0` "${INSTALL_JDK_PATH}/bin" "${INSTALL_JDK_PATH}/man/man1"
                alt_install_javac 9`printf "%02u%02u%03u" 0 0 0` "${INSTALL_JDK_PATH}/bin" "${INSTALL_JDK_PATH}/man/man1"
            else
                alt_install_java 9`printf "%02u%02u%03u" 0 0 0` "${INSTALL_JRE_PATH}/bin" "${INSTALL_JRE_PATH}/man/man1"
            fi
        else
            echo "/usr/sbin/alternatives not available, skip registering alternatives for java..."
        fi
    The calling is at the very end of the post script.
    If my understanding of the calling section is correct, the first test will succede because /usr/sbin/alternatives does exist and the second will always succede because 1 = 1 is always true.
    This will then call "alt_install_java 9000 /usr/java/jdk-9/bin /usr/java/jdk-9/man/man1" and "alt_install_javac 9000 /usr/java/jdk-9/bin /usr/java/jdk-9/man/man1".
    As the update-alternatives functions have the same files as slaves in "alt_install_java" that are in "alt_install_javac" the update-alternatives will always fail. As I understand it, a link via alternatives to a file can not be a slave within two alternatives symlink groups.
    On my system this is demonstarted by the failure of the rpm install with update-alternatives errors. Why your system gives no errors I have no idea.

    Peter.

  4. #4

    Default Re: Installing Oracle Java 9 Standard Edition.

    I just install with zypper and works fine.

    As root:

    Code:
    linux-g8mj:~ # zypper in jdk-9.0.1_linux-x64_bin.rpm  
    Baixando os metadados do repositório 'openSUSE-Leap-42.3-Update-Non-Oss' ....................................................................................................[concluído]
    Construindo o cache do repositório 'openSUSE-Leap-42.3-Update-Non-Oss' ......................................................................................................[concluído]
    Carregando dados do repositório...
    Lendo os pacotes instalados...
    Resolvendo dependências de pacote...
    
    O seguinte pacote NOVO será instalado:
      jdk-9.0.1
    
    1 novo pacote a ser instalado.
    Tamanho total do download: 305,0 MiB. Já em cache: 0 B. Após a operação, 551,5 MiB adicionais serão utilizados.
    Continuar? [s/n/...? exibe todas as opções] (s): 
    Baixando pacote jdk-9.0.1-2000:9.0.1-ga.x86_64                                                                                                (1/1), 305,0 MiB (551,5 MiB descompactado)
    jdk-9.0.1_linux-x64_bin.rpm:
       O pacote não está assinado!
    
    jdk-9.0.1-2000:9.0.1-ga.x86_64 (Cache de arquivos RPM simples): Falha na verificação da assinatura [6-O arquivo não está assinado]
    Cancelar, repetir ou ignorar? [c/r/i] (c): i
    Verificando por conflito de arquivos: .......................................................................................................................................[concluído]
    (1/1) Instalando: jdk-9.0.1-2000:9.0.1-ga.x86_64 ............................................................................................................................[concluído]
    linux-g8mj:~ # java -version
    java version "9.0.1"
    Java(TM) SE Runtime Environment (build 9.0.1+11)
    Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
    

Posting Permissions

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