Java installation issues on Ubuntu

后端 未结 7 1157
时光取名叫无心
时光取名叫无心 2021-01-19 02:46

Trying to install Java (JDK 6) on my new Ubuntu system and getting some bizarro errors. This is my first time ever using any flavor of Linux and so I\'m sure it\'s

7条回答
  •  迷失自我
    2021-01-19 02:57

    The JDK you installed from Sun/Oracle is the original JDK. The "headless" JDK is the open source alternative. When you run the JDK BIN file, it simply extracts the archive. When you entered the java -version command, it found the FOSS Java, not the Java you had extracted in /opt. As somebody else had mentioned, developers keep multiple versions of the JDK. If you wish to use the Oracle's Java, then you need link /usr/bin/java to /opt/jdk1.6.0_23/bin/java.

    sudo ln -s /usr/bin/java /opt/jdk1.6.0_23/bin/java
    

    For this to work, the existing java command should be first delinked from the "headless" JDK. (Do the following before the previous command.)

    sudo mv /usr/bin/java /usr/bin/java_old
    

    This assumes that there is a link or executable named java in /usr/bin. Use the which command to be sure.

    which java
    

提交回复
热议问题