linuxÔõôÉó²éjdk°æ±¾
ÔÚ linux ÖÐÉó²é jdk °æ±¾µÄÒªÁìÓУºÔËÐÐ “java -version” ÏÂÁî¡£ÔËÐÐ “javac -version” ÏÂÁ½öÊÊÓÃÓÚÒÑ×°Öà jdk µÄϵͳ£©¡£¼ì²é “/usr/lib/jvm” Ŀ¼ÖеÄÎļþ¡£Ê¹Óà “which java” ÏÂÁî²éÕÒ java ÏÂÁîµÄ·¾¶¡£Ê¹Óà “env | grep java_home” ÏÂÁîÉó²é java_home ÇéÐαäÁ¿¡£¹ØÓÚʹÓà update-alternatives ÖÎÀí java ×°ÖõÄϵͳ£¬ÔËÐÐ “update-alternatives
ÔõÑùÔÚ Linux ÖÐÉó²é JDK °æ±¾
ÔÚ Linux ϵͳÖÐÉó²éÒÑ×°ÖÃµÄ JDK °æ±¾ÓÐÒÔϼ¸ÖÖÒªÁ죺
1. Java -version ÏÂÁî
ÕâÊÇ×î³£¼ûµÄÏÂÁËüÖ±½ÓÏÔʾ Java ÔËÐÐʱÇéÐÎ (JRE) ºÍ Java ¿ª·¢¹¤¾ß°ü (JDK) µÄ°æ±¾¡£
java -version
µÇ¼ºó¸´ÖÆ
2. javac -version ÏÂÁî
´ËÏÂÁî½öÊÊÓÃÓÚÒÑ×°Öà JDK µÄϵͳ£¬ËüÏÔʾ Java ±àÒëÆ÷µÄ°æ±¾£¬¸Ã±àÒëÆ÷ÊÇ JDK µÄÒ»²¿·Ö¡£
javac -version
µÇ¼ºó¸´ÖÆ
3. ¼ì²éÎļþϵͳ
ÔÚ Ubuntu ϵͳÖУ¬Ä¬ÈÏÇéÐÎÏ£¬JDK ×°ÖÃÔÚ /usr/lib/jvm Ŀ¼Ï¡£Äú¿ÉÒÔÉó²é¸ÃĿ¼ÒÔÉó²éÒÑ×°ÖÃµÄ JDK °æ±¾£º
ls /usr/lib/jvm
µÇ¼ºó¸´ÖÆ
4. ʹÓà which ÏÂÁî²éÕÒ Java ÏÂÁî
which ÏÂÁî¿ÉÒÔÕÒµ½ Java ÏÂÁîµÄ·¾¶£¬ÆäÖаüÀ¨ JDK °æ±¾ÐÅÏ¢£º
which java
µÇ¼ºó¸´ÖÆ
5. env ÏÂÁî
env ÏÂÁî¿ÉÒÔÏÔʾϵͳÇéÐαäÁ¿£¬ÆäÖпÉÄÜ°üÀ¨ JAVA_HOME ±äÁ¿£¬¸Ã±äÁ¿Ö¸Ïò JDK µÄ×°ÖÃĿ¼¡£
env | grep JAVA_HOME
µÇ¼ºó¸´ÖÆ
6. update-alternatives ÏÂÁî
¹ØÓÚʹÓà update-alternatives ÖÎÀí Java ×°ÖõÄϵͳ£¬Äú¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÉó²éÄ¿½ñµÄ JDK °æ±¾£º
update-alternatives --query java
µÇ¼ºó¸´ÖÆ
ͨ¹ýʹÓÃÉÏÊöÒªÁìÖеÄÈκÎÒ»ÖÖ£¬Äú¶¼¿ÉÒÔÇáËɵØÔÚ Linux ϵͳÖÐÈ·¶¨ÒÑ×°ÖÃµÄ JDK °æ±¾¡£
ÒÔÉϾÍÊÇlinuxÔõôÉó²éjdk°æ±¾µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡