Linuxã§ã¯ãæ¨æºããã±ã¼ã¸ã§ããGCCã®Javaè¨èªæ©è½ã§ããGCJçã®ã³ãã³ããæ¨æºãã£ã¬ã¯ããªï¼/usr/bin/)ããèµ·åããã¾ããä¾ãã°ãjava, rmid, pack200, keytoolãªã©ã§ãããããã/usr/bin/ã®ä¸ã«ç´æ¥GCJã®ã³ãã³ããå ¥ã£ã¦ããã®ã§ã¯ãªããå®ã¯ã·ã³ããªãã¯ãªã³ã¯ã¨ãªã£ã¦ãã¾ãã以ä¸ã¯CentOS 5.3ã«ããã/usr/bin/javaã®ã³ãã³ãã®å®ä½ã§ãã
~$ ls -l /usr/bin/java lrwxrwxrwx 1 root root 22 6æ 13 17:27 /usr/bin/java -> /etc/alternatives/java ~$ ls -l /etc/alternatives/java lrwxrwxrwx 1 root root 35 6æ 13 17:27 /etc/alternatives/java -> /usr/lib/jvm/jre-1.4.2-gcj/bin/java ~$ ls -l /usr/lib/jvm/jre-1.4.2-gcj/bin/java lrwxrwxrwx 1 root root 12 2æ 28 23:32 /usr/lib/jvm/jre-1.4.2-gcj/bin/java -> /usr/bin/gij ~$ file /usr/bin/gij /usr/bin/gij: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped ~$
/usr/bin/javaã¯ãä¸æ¦/etc/alternatives/javaãä»ãã¦ã/usr/lib/jvm/jre-1.4.2-gcj/bin/javaãæããããã«ãããå®ä½ã§ãã/usr/bin/gijãæãã¨ããã·ã³ããªãã¯ãªã³ã¯é£éã¨ãªã£ã¦ãã¾ãã
ããã§ã/etc/alternativesãã£ã¬ã¯ããªã«ããã·ã³ããªãã¯ãªã³ã¯ã¯ãè¤æ°ã®ãã¼ã¸ã§ã³ã®ã¢ããªã±ã¼ã·ã§ã³ã®åãæ¿ãããå種ã§ç°ãªãå®è£ ã®ã¢ããªã±ã¼ã·ã§ã³ã®åãæ¿ããè¡ãalternativesã¨ããæ©è½ã«ãããã®ã§ãã
~$ alternatives --display java java -ã¹ãã¼ã¿ã¹ã¯èªåã§ãã ãªã³ã¯ã¯ç¾å¨ /usr/lib/jvm/jre-1.4.2-gcj/bin/java ãæãã¦ãã¾ãã /usr/lib/jvm/jre-1.4.2-gcj/bin/java - åªå é ç® 1420 ã¹ã¬ã¼ã javaws: (null) ã¹ã¬ã¼ã keytool: /usr/lib/jvm/jre-1.4.2-gcj/bin/keytool : ï¼ä¸ç¥ï¼ ã¹ã¬ã¼ã tnameserv.1.gz: (null) ã¹ã¬ã¼ã unpack200.1.gz: (null) ç¾å¨ã®ãæé©ããã¼ã¸ã§ã³ã¯ /usr/lib/jvm/jre-1.4.2-gcj/bin/java ã§ãã ~$
alternativesã«ãå¥ãªãã¼ã¸ã§ã³ã®javaãç»é²ãã¦ããã¨ã/etc/alternativesã®åãæ¿ãã«ããè¨å®å¤æ´ãã§ããããã«ãªãã¾ãã
ããã§ãSunã®JDKãæã¤ã³ãã³ããããã¤ãalternativesã§åãæ¿ã管çã§ããããç»é²ãã¾ãã--installãªãã·ã§ã³ã使ç¨ãã¾ããã¾ããè¤æ°ã®ã³ãã³ãã1ã¤ã®é ç®ã§ã¾ã¨ãã¦åãæ¿ããããã--slaveãªãã·ã§ã³ã§ä¸é£ã§åãæ¿ããã³ãã³ããæå®ãã¾ãã
# alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_14/bin/java 200 \ --slave /usr/bin/java_vm java_vm /usr/java/jdk1.6.0_14/jre/bin/java_vm \ --slave /usr/bin/javaws javaws /usr/java/jdk1.6.0_14/jre/bin/javaws \ : ï¼ä¸ç¥ï¼ --slave /usr/bin/unpack200 unpack200 /usr/java/jdk1.6.0_14/jre/bin/unpack200 #
åªå 度ã®æå®ã¯ããåãããªãã£ãã®ã§ãã¦ãã¨ã¼ãªå¤ãå ¥ãã¦ãã¾ãã
ç»é²ãæåããã¨ãåãæ¿ããã§ããããã«ãªãã¾ãã
# alternatives --config java 2 ããã°ã©ã ããã 'java' ãæä¾ãã¾ãã é¸æ ã³ãã³ã ----------------------------------------------- *+ 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java 2 /usr/java/jdk1.6.0_14/bin/java Enter ãæ¼ãã¦ç¾å¨ã®é¸æ [+] ãä¿æããããé¸æçªå·ãå ¥åãã¾ã:2