OpenSUSE에 Java 8 JDK 설치 - 업데이트 대안

OpenSUSE에 Java 8 JDK 설치 - 업데이트 대안

이 질문에 대한 답변을 찾기 위해 많은 OpenSUSE 포럼을 검색했지만 지금까지 찾지 못했습니다. 간단히 말해서 Oracle에서 JDK의 RPM을 설치할 때 다음 메시지를 받았습니다.

> sudo zypper install jdk-8u111-linux-x64.rpm
[sudo] password for root:
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:
  jdk1.8.0_111

1 new package to install.
Overall download size: 158.3 MiB. Already cached: 0 B. After the operation, additional 258.5 MiB will be used.
Continue? [y/n/? shows all options] (y): y
Retrieving package jdk1.8.0_111-2000:1.8.0_111-fcs.x86_64           (1/1), 158.3 MiB (258.5 MiB unpacked)
Checking for file conflicts: ......................................................................[done]
(1/1) Installing: jdk1.8.0_111-2000:1.8.0_111-fcs.x86_64 ..........................................[done]
Additional rpm output:
Unpacking JAR files...
    tools.jar...
    plugin.jar...
    javaws.jar...
    deploy.jar...
    rt.jar...
    jsse.jar...
    charsets.jar...
    localedata.jar...
update-alternatives: using /usr/java/jdk1.8.0_111/jre/bin/java to provide /usr/bin/java (java) in auto mode
update-alternatives: error: alternative ControlPanel can't be slave of javac: it is a slave of java
warning: %post(jdk1.8.0_111-2000:1.8.0_111-fcs.x86_64) scriptlet failed, exit status 2

제가 장황하게 말한 점을 용서해주세요. 제가 보는 것을 여러분도 봐주시길 바랍니다. 이것은 OpenSUSE Tumbleweed를 새로 설치한 것입니다.

또한 OpenSUSE Leap 42.2에 새로 설치해 보았습니다. 첫 번째 시도 후에는 Java 지원(OpenJDK 없음) 없이 다시 로드하고 이 설치에서 했던 것처럼 처음부터 시작했습니다. 특히 OpenSUSE에 Java를 설치하기 위한 가이드를 따랐습니다. Java가 설치되어 있지 않은 분, 이전에 Java OpenJDK를 설치한 분, 어떤 이유로든 JDK와 JRE가 모두 설치되어 있는 분 등

참고로 Java 자체는 잘 작동하지만 제어판은 그렇지 않은 것 같습니다. 업데이트 대안을 수동으로 사용해 보았고, 처음부터 컴파일을 시도했으며, 다시 로드하고, Leap에서 Tumbleweed로 전환했습니다. 다음은 도움이 될 수 있는 몇 가지 추가 정보입니다.

> sudo update-alternatives --list java
/usr/java/jdk1.8.0_111/jre/bin/java
> sudo update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /usr/java/jdk1.8.0_111/jre/bin/java
Nothing to configure.
> java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
> javac -version
javac 1.8.0_111

다시 Java가 실행되는 것을 봅니다. 하지만 저는 이 문제가 재현하기 쉬운 이유와 해결 방법을 여전히 알고 싶습니다.

답변1

이 설치를 수행하는 과정은 대부분의 사람들이 생각하는 것보다 쉬우며, 놀랍게도 이를 수행하는 방법에 대한 훌륭하거나 간단한 정보가 많지 않습니다. 위의 답변은 정확하지만 일부 내용이 약간 오래되었습니다.

  1. 오라클 JDK 1.8.0_151 다운로드

    #// rpm Installation Oracle JDK 1.8.0_151
    wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"  http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.rpm
    
  2. 설치 명령 실행

    #// installation command
    rpm -ivh jdk-8u151-linux-x64.rp
    
  3. 버전이 기본 설정에 따라 구성/설치되었는지 확인하세요.

    java -version
    
  4. 명령줄 인터페이스 또는 편집기를 사용하여 환경 변수 설정

    #//Command line 
    export JAVA_HOME=/usr/java/jdk1.8.0_151/
    export PATH=$PATH:/usr/java/jdk1.8.0_151/bin
    
    #// set variables at the END of the file etc/profile
    sudo vim /etc/profile/
    
    #//Variables to set within the file
    JAVA_HOME=/usr/java/jdk1.8.0_151
    PATH=$Path:$HOME/bin:@JAVA_HOME/bin
    export JAVA_HOME
    export PATH
    
    #//To save / exit vim execute the following key strokes
    <ESC>
    <:>
    <x>
    

답변2

몇 시간의 노력 끝에 마침내 이 짜증나는 문제를 해결했습니다.

rpm -ivh jdk-8u121-linux-x64.rpmjdk를 직접 설치할 수는 없고 jdk-8u121-linux-x64.tar.gz수동으로 다운로드하여 압축을 푸는 것 같습니다 .

(JW 1/8/2017 개정) - 실제로 다음 기능을 통해 rpm을 통해 직접 설치할 수 있습니다.

   #//rpm install
   rpm -ivh jdk-8u151-linux-x64.rpm

대부분의 프로그램은 다음에서 찾을 수 있습니다.이 페이지, 설치하려는 jdk 버전에 주의하세요.

jdk-8u121 x64를 예로 들면 근본 원인으로 전환하는 것이 좋습니다. 그렇지 않으면 다음과 같은 원인이 많이 있습니다 sudo.

1. jdk를 다운로드하고 선택jdk-8u121-linux-x64.tar.gz

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

2.cd /path/to/downloaded/java

삼.tar -xzf ./jdk-7uX-linux-XX.tar.gz

4.Open JDK는 기본적으로 설치되므로 Oracle Java도 다음으로 이동합니다 /usr/lib64./usr/lib64mv ./jdk1.8.0_121/ /usr/lib64/

5. 심볼릭 링크를 생성합니다 /usr/lib64/jdk1.X.X_XX/(이는 이후 업데이트에 중요합니다). ln -s -T /usr/lib64/jdk1.X.X_XX/ /usr/lib64/jdk_Oracle

6. 설치와 관련된 man 파일을 압축합니다.

gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/java.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/keytool.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/orbd.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/policytool.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/rmid.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/rmiregistry.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/servertool.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/tnameserv.1)

7. jvm-exports 디렉토리를 준비하고 버전에 주의하세요!

mkdir /usr/lib64/jvm-exports/jdk_Oracle
cd /usr/lib64/jvm-exports/jdk_Oracle


ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jaas-1.8.0_Orac.jar
ln -s jaas-1.8.0_Orac.jar jaas-1.8.0.jar
ln -s jaas-1.8.0_Orac.jar jaas.jar
ln -s /usr/lib64/jdk_Oracle/jre/lib/jce.jar jce-1.8.0_Orac.jar
ln -s jce-1.8.0_Orac.jar jce-1.8.0.jar
ln -s jce-1.8.0_Orac.jar jce.jar
ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jdbc-stdext-1.8.0_Orac.jar
ln -s jdbc-stdext-1.8.0_Orac.jar jdbc-stdext-1.8.0.jar
ln -s jdbc-stdext-1.8.0_Orac.jar jdbc-stdext-3.0.jar
ln -s jdbc-stdext-1.8.0_Orac.jar jdbc-stdext.jar
ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jndi-1.8.0_Orac.jar
ln -s jndi-1.8.0_Orac.jar jndi-1.8.0.jar
ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jndi-cos-1.8.0_Orac.jar
ln -s jndi-cos-1.8.0_Orac.jar jndi-cos-1.8.0.jar
ln -s jndi-cos-1.8.0_Orac.jar jndi-cos.jar
ln -s jndi-1.8.0_Orac.jar jndi.jar
ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jndi-ldap-1.8.0_Orac.jar
ln -s jndi-ldap-1.8.0_Orac.jar jndi-ldap-1.8.0.jar
ln -s jndi-ldap-1.8.0_Orac.jar jndi-ldap.jar
ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jndi-rmi-1.8.0_Orac.jar
ln -s jndi-rmi-1.8.0_Orac.jar jndi-rmi-1.8.0.jar
ln -s jndi-rmi-1.8.0_Orac.jar jndi-rmi.jar
ln -s /usr/lib64/jdk_Oracle/jre/lib/jsse.jar jsse-1.8.0_Orac.jar
ln -s jsse-1.8.0_Orac.jar jsse-1.8.0.jar
ln -s jsse-1.8.0_Orac.jar jsse.jar
ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar sasl-1.8.0_Orac.jar
ln -s sasl-1.8.0_Orac.jar sasl-1.8.0.jar
ln -s sasl-1.8.0_Orac.jar sasl.jar


/usr/sbin/update-alternatives --install /usr/bin/java java /usr/lib64/jdk_Oracle/bin/java 3 --slave /usr/share/man/man1/java.1.gz java.1.gz /usr/lib64/jdk_Oracle/man/man1/java.1.gz --slave /usr/lib64/jvm/jre jre /usr/lib64/jdk_Oracle/jre --slave /usr/lib64/jvm-exports/jre jre_exports /usr/lib64/jvm-exports/jdk_Oracle --slave /usr/bin/keytool keytool /usr/lib64/jdk_Oracle/bin/keytool --slave /usr/share/man/man1/keytool.1.gz keytool.1.gz /usr/lib64/jdk_Oracle/man/man1/keytool.1.gz --slave /usr/bin/orbd orbd /usr/lib64/jdk_Oracle/bin/orbd --slave /usr/share/man/man1/orbd.1.gz orbd.1.gz /usr/lib64/jdk_Oracle/man/man1/orbd.1.gz --slave /usr/bin/policytool policytool /usr/lib64/jdk_Oracle/bin/policytool --slave /usr/share/man/man1/policytool.1.gz policytool.1.gz /usr/lib64/jdk_Oracle/man/man1/policytool.1.gz --slave /usr/bin/rmid rmid /usr/lib64/jdk_Oracle/bin/rmid --slave /usr/share/man/man1/rmid.1.gz rmid.1.gz /usr/lib64/jdk_Oracle/man/man1/rmid.1.gz --slave /usr/bin/rmiregistry rmiregistry /usr/lib64/jdk_Oracle/bin/rmiregistry --slave /usr/share/man/man1/rmiregistry.1.gz rmiregistry.1.gz /usr/lib64/jdk_Oracle/man/man1/rmiregistry.1.gz --slave /usr/bin/servertool servertool /usr/lib64/jdk_Oracle/bin/servertool --slave /usr/share/man/man1/servertool.1.gz servertool.1.gz /usr/lib64/jdk_Oracle/man/man1/servertool.1.gz --slave /usr/bin/tnameserv tnameserv /usr/lib64/jdk_Oracle/bin/tnameserv --slave /usr/share/man/man1/tnameserv.1.gz tnameserv.1.gz /usr/lib64/jdk_Oracle/man/man1/tnameserv.1.gz

8. 설치와 관련된 man 파일을 압축합니다.

gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/appletviewer.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/apt.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/extcheck.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jar.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jarsigner.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/javac.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/javadoc.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/javah.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/javap.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jcmd.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jconsole.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jdb.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jhat.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jinfo.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jmap.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jps.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jrunscript.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jsadebugd.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jstack.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jstat.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jstatd.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/native2ascii.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/pack200.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/rmic.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/schemagen.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/serialver.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/unpack200.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/wsgen.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/wsimport.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/xjc.1)




/usr/sbin/update-alternatives --install /usr/bin/javac javac /usr/lib64/jdk_Oracle/bin/javac 3 \
--slave /usr/bin/appletviewer appletviewer /usr/lib64/jdk_Oracle/bin/appletviewer \
--slave /usr/share/man/man1/appletviewer.1.gz appletviewer.1.gz /usr/lib64/jdk_Oracle/man/man1/appletviewer.1.gz \
--slave /usr/bin/apt apt /usr/lib64/jdk_Oracle/bin/apt \
--slave /usr/share/man/man1/apt.1.gz apt.1.gz /usr/lib64/jdk_Oracle/man/man1/apt.1.gz \
--slave /usr/bin/extcheck extcheck /usr/lib64/jdk_Oracle/bin/extcheck \
--slave /usr/share/man/man1/extcheck.1.gz extcheck.1.gz /usr/lib64/jdk_Oracle/man/man1/extcheck.1.gz \
--slave /usr/bin/jar jar /usr/lib64/jdk_Oracle/bin/jar \
--slave /usr/share/man/man1/jar.1.gz jar.1.gz /usr/lib64/jdk_Oracle/man/man1/jar.1.gz \
--slave /usr/bin/jarsigner jarsigner /usr/lib64/jdk_Oracle/bin/jarsigner \
--slave /usr/share/man/man1/jarsigner.1.gz jarsigner.1.gz /usr/lib64/jdk_Oracle/man/man1/jarsigner.1.gz \
--slave /usr/lib64/jvm/java java_sdk /usr/lib64/jdk_Oracle \
--slave /usr/lib64/jvm-exports/java java_sdk_exports /usr/lib64/jvm-exports/jdk_Oracle \
--slave /usr/share/man/man1/javac.1.gz javac.1.gz /usr/lib64/jdk_Oracle/man/man1/javac.1.gz \
--slave /usr/bin/javadoc javadoc /usr/lib64/jdk_Oracle/bin/javadoc \
--slave /usr/share/man/man1/javadoc.1.gz javadoc.1.gz /usr/lib64/jdk_Oracle/man/man1/javadoc.1.gz \
--slave /usr/bin/javah javah /usr/lib64/jdk_Oracle/bin/javah \
--slave /usr/share/man/man1/javah.1.gz javah.1.gz /usr/lib64/jdk_Oracle/man/man1/javah.1.gz \
--slave /usr/bin/javap javap /usr/lib64/jdk_Oracle/bin/javap \
--slave /usr/share/man/man1/javap.1.gz javap.1.gz /usr/lib64/jdk_Oracle/man/man1/javap.1.gz \
--slave /usr/share/man/man1/jcmd.1.gz jcmd.1.gz /usr/lib64/jdk_Oracle/man/man1/jcmd.1.gz \
--slave /usr/bin/jconsole jconsole /usr/lib64/jdk_Oracle/bin/jconsole \
--slave /usr/share/man/man1/jconsole.1.gz jconsole.1.gz /usr/lib64/jdk_Oracle/man/man1/jconsole.1.gz \
--slave /usr/bin/jdb jdb /usr/lib64/jdk_Oracle/bin/jdb \
--slave /usr/share/man/man1/jdb.1.gz jdb.1.gz /usr/lib64/jdk_Oracle/man/man1/jdb.1.gz \
--slave /usr/bin/jhat jhat /usr/lib64/jdk_Oracle/bin/jhat \
--slave /usr/share/man/man1/jhat.1.gz jhat.1.gz /usr/lib64/jdk_Oracle/man/man1/jhat.1.gz \
--slave /usr/bin/jinfo jinfo /usr/lib64/jdk_Oracle/bin/jinfo \
--slave /usr/share/man/man1/jinfo.1.gz jinfo.1.gz /usr/lib64/jdk_Oracle/man/man1/jinfo.1.gz \
--slave /usr/bin/jmap jmap /usr/lib64/jdk_Oracle/bin/jmap \
--slave /usr/share/man/man1/jmap.1.gz jmap.1.gz /usr/lib64/jdk_Oracle/man/man1/jmap.1.gz \
--slave /usr/bin/jps jps /usr/lib64/jdk_Oracle/bin/jps \
--slave /usr/share/man/man1/jps.1.gz jps.1.gz /usr/lib64/jdk_Oracle/man/man1/jps.1.gz \
--slave /usr/bin/jrunscript jrunscript /usr/lib64/jdk_Oracle/bin/jrunscript \
--slave /usr/share/man/man1/jrunscript.1.gz jrunscript.1.gz /usr/lib64/jdk_Oracle/man/man1/jrunscript.1.gz \
--slave /usr/bin/jsadebugd jsadebugd /usr/lib64/jdk_Oracle/bin/jsadebugd \
--slave /usr/share/man/man1/jsadebugd.1.gz jsadebugd.1.gz /usr/lib64/jdk_Oracle/man/man1/jsadebugd.1.gz \
--slave /usr/bin/jstack jstack /usr/lib64/jdk_Oracle/bin/jstack \
--slave /usr/share/man/man1/jstack.1.gz jstack.1.gz /usr/lib64/jdk_Oracle/man/man1/jstack.1.gz \
--slave /usr/bin/jstat jstat /usr/lib64/jdk_Oracle/bin/jstat \
--slave /usr/share/man/man1/jstat.1.gz jstat.1.gz /usr/lib64/jdk_Oracle/man/man1/jstat.1.gz \
--slave /usr/bin/jstatd jstatd /usr/lib64/jdk_Oracle/bin/jstatd \
--slave /usr/share/man/man1/jstatd.1.gz jstatd.1.gz /usr/lib64/jdk_Oracle/man/man1/jstatd.1.gz \
--slave /usr/bin/native2ascii native2ascii /usr/lib64/jdk_Oracle/bin/native2ascii \
--slave /usr/share/man/man1/native2ascii.1.gz native2ascii.1.gz /usr/lib64/jdk_Oracle/man/man1/native2ascii.1.gz \
--slave /usr/bin/pack200 pack200 /usr/lib64/jdk_Oracle/bin/pack200 \
--slave /usr/share/man/man1/pack200.1.gz pack200.1.gz /usr/lib64/jdk_Oracle/man/man1/pack200.1.gz \
--slave /usr/bin/rmic rmic /usr/lib64/jdk_Oracle/bin/rmic \
--slave /usr/share/man/man1/rmic.1.gz rmic.1.gz /usr/lib64/jdk_Oracle/man/man1/rmic.1.gz \
--slave /usr/bin/schemagen schemagen /usr/lib64/jdk_Oracle/bin/schemagen \
--slave /usr/share/man/man1/schemagen.1.gz schemagen.1.gz /usr/lib64/jdk_Oracle/man/man1/schemagen.1.gz \
--slave /usr/bin/serialver serialver /usr/lib64/jdk_Oracle/bin/serialver \
--slave /usr/share/man/man1/serialver.1.gz serialver.1.gz /usr/lib64/jdk_Oracle/man/man1/serialver.1.gz \
--slave /usr/bin/unpack200 unpack200 /usr/lib64/jdk_Oracle/bin/unpack200 \
--slave /usr/share/man/man1/unpack200.1.gz unpack200.1.gz /usr/lib64/jdk_Oracle/man/man1/unpack200.1.gz \
--slave /usr/bin/wsgen wsgen /usr/lib64/jdk_Oracle/bin/wsgen \
--slave /usr/share/man/man1/wsgen.1.gz wsgen.1.gz /usr/lib64/jdk_Oracle/man/man1/wsgen.1.gz \
--slave /usr/bin/wsimport wsimport /usr/lib64/jdk_Oracle/bin/wsimport \
--slave /usr/share/man/man1/wsimport.1.gz wsimport.1.gz /usr/lib64/jdk_Oracle/man/man1/wsimport.1.gz \
--slave /usr/bin/xjc xjc /usr/lib64/jdk_Oracle/bin/xjc \
--slave /usr/share/man/man1/xjc.1.gz xjc.1.gz /usr/lib64/jdk_Oracle/man/man1/xjc.1.gz

9.웹 브라우저 플러그인

/usr/sbin/update-alternatives --install /usr/lib64/browser-plugins/javaplugin.so javaplugin /usr/lib64/jdk_Oracle/jre/lib/amd64/libnpjp2.so 3 --slave /usr/bin/javaws javaws /usr/lib64/jdk_Oracle/jre/bin/javaws --slave /usr/share/man/man1/javaws.1 javaws.1 /usr/lib64/jdk_Oracle/man/man1/javaws.1

10. 자바 제어판 추가

ln -s /usr/lib64/jdk_Oracle/jre/bin/jcontrol /usr/bin/
ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/icons/hicolor/16x16/apps/sun-jcontrol.png /usr/share/icons/hicolor/16x16/apps/
ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/icons/hicolor/48x48/apps/sun-jcontrol.png /usr/share/icons/hicolor/48x48/apps/
ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/icons/LowContrast/16x16/apps/sun-jcontrol.png /usr/share/icons/locolor/16x16/apps/
ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/icons/LowContrast/48x48/apps/sun-jcontrol.png /usr/share/icons/locolor/48x48/apps/
ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/applications/sun_java.desktop /usr/share/applications

그게 다야! 자세한 내용은오픈수세 위키

관련 정보