When and Why run alternatives --install java jar javac javaws on installing jdk in linux

前端 未结 6 1760
耶瑟儿~
耶瑟儿~ 2021-02-14 08:56

To install java in linux (I used CentOS, RHEL is same too), I used this command

rpm -Uvh /path/to/binary/jdk-7u55-linux-x64.rpm

and verified java

6条回答
  •  孤街浪徒
    2021-02-14 09:30

    When you install JDK on Linux, what gets installed depends on the type of package, version and distribution. You can refer to the following links for information about the installation location on linux:

    JDK Installation for Linux Platforms - Version 8

    JDK Installation for Linux Platforms - Version 7

    Once you install JDK, the bin folder containing tools might not get added to the environment variable PATH. Commands typed on the terminal needs to be from the locations specified in the PATH variable. In cases when JDK\bin does not get added, the user would need to configure it manually as mentioned in Installing the JDK Software

    alternatives command is being used to create a symbolic link. Here, it is being directed to use the command to add the tools like javac, javaw to /usr/bin which exists in the PATH variable by default.

    If( you could execute java -version outside of JDK/bin && not by specifying the complete path && if the version and bundle prints to be as that of package you installed ){ you need not run the alternatives command.}

提交回复
热议问题