How to check Oracle Java version if multiple versions of Java installed on Ubuntu

后端 未结 5 1369
感情败类
感情败类 2021-02-07 10:46

I have both OpenJDK and Oracle Java installed on my Ubuntu. If the activated java is OpenJDK, is there a way to check the version of Oracle java in bash shell

5条回答
  •  旧巷少年郎
    2021-02-07 11:36

    If you are using the openjdk java, then the oracle Java in your PC is just a folder. There is no command to check the version of that if you are not using it.

    If you once used oracle java then it must be in your java alternatives and you can find the folder (usually with version in name) with:

    update-alternatives --config java
    

    If it says something like /usr/lib/jvm/jdk1.8.0_05/bin/java, then you have 1.8 in your pc.

    If you haven't used oracle java anytime you simply have to check what you have downloaded.

    If you want to simply see the version you are using:

    java -version
    

    Hope it helps

提交回复
热议问题