CentOSã§ãalternativesãã³ãã³ãã使ç¨ãã¦Javaã®ãã¼ã¸ã§ã³ãåãæ¿ãã
CentOSã®JavaãOpenJDKãããªãã¦ãOracleã®JDKã«å¤æ´ãããã¨ããæã
ä»ã¾ã§ã¯ãrpm -qa | grep javaãã§å¯¾è±¡ãæ´ãã ãã¦ãyumãã³ãã³ãã§ã¢ã³ã¤ã³ã¹ãã¼ã«ãã¦ãã¾ããã
ãã ãã®æ¹æ³ã ã¨ä»ã®ããã±ã¼ã¸ã¨é¢é£ã¥ãã¦ããå ´åããããããã¾ãã¹ãã¼ãã§ã¯ããã¾ããã
ã¨ããããalternativesãã³ãã³ãã使ç¨ããã¨ãæ§ã
ãªãã¼ã¸ã§ã³ã®Javaãå
±åããã¦åãæ¿ããäºãã§ãã¾ãã
æé ã¯ä¸è¨ã«ãªãã¾ãã
æ¢ã«Oracleã®JDKãã¤ã³ã¹ãã¼ã«ãã¦ããäºãåæã§ãã
1 ç¾å¨ã®JDKã®ç¢ºèª
# alternatives --config java 1 ããã°ã©ã ããã 'java' ãæä¾ãã¾ãã é¸æ ã³ãã³ã ----------------------------------------------- *+ 1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
ç¾å¨ã¯ã/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/javaããæå¹ã«ãªã£ã¦ãã¾ãã
2 ã¤ã³ã¹ãã¼ã«ããOracleã®JDKãç»é²
alternatives --install /usr/bin/java java /usr/java/default/bin/java 16024
åãã©ã¡ã¼ã¿ã®æ¦è¦ã¯ä¸è¨ã«ãªãã¾ãã
第1ãã©ã¡ã¼ã¿ | ã/usr/bin/javaã | å®è¡ãããªã³ã¯ãæå®ãã¾ãã |
---|---|---|
第2ãã©ã¡ã¼ã¿ | ãjavaã | ç»é²å¯¾è±¡ã®ã°ã«ã¼ããæå®ãã¾ãã |
第3ãã©ã¡ã¼ã¿ | ã/usr/java/default/bin/javaã | å®éã«å®è¡ããã³ãã³ãã®ãã¹ãæå®ãã¾ãã |
第4ãã©ã¡ã¼ã¿ | ã16021ã | åªå 度ãæå®ãã¾ãã |
ä»å㯠JDK1.6.0_24 ã§ãã®ã§ã16024ãã¨ãã¦ãã¾ãã
ç´°ãããã¼ã¸ã§ã³ç®¡çãè¡ãå ´åã¯ã/usr/java/jdk1.6.0_24/bin/javaãã®ããã«ç»é²ããã¨ããã¨æãã¾ãã
å度è¨å®ã確èªããã¨ç»é²ããJDKãå¢ãã¦ããäºã確èªã§ãã¾ãã
# alternatives --config java 2 ããã°ã©ã ããã 'java' ãæä¾ãã¾ãã é¸æ ã³ãã³ã ----------------------------------------------- + 1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java * 2 /usr/java/default/bin/java Enter ãæ¼ãã¦ç¾å¨ã®é¸æ [+] ãä¿æããããé¸æçªå·ãå ¥åãã¾ã:
ããã§ã2ããå ¥åãã¦Enterãæ¼ä¸ããã¨è¨å®ãåæ ããã¾ãã
3 Javaã®ãã¼ã¸ã§ã³ã®ç¢ºèª
# java -version java version "1.6.0_24" Java(TM) SE Runtime Environment (build 1.6.0_24-b07) Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
ç»é²ããJDKãæå¹ã«ãªã£ã¦ãã¾ãã
ãã®æ¹æ³ãªãJDKã®ãã¼ã¸ã§ã³ãå¢ãã¦ãç°¡åã«åãæ¿ããäºãã§ãã¾ãã