Resolving version conflict between java and javac on Ubuntu

后端 未结 5 1606
故里飘歌
故里飘歌 2021-02-01 06:09

I have a problem with my compiled Java application on Ubuntu. It throws UnsupportedClassVersionError. I am compiling with a higher JDK version than the one that is

5条回答
  •  星月不相逢
    2021-02-01 06:27

    Type following command in terminal :

      sudo update-alternatives --config java
    

    It will ask you for:

    There are 2 choices for the alternative java (providing /usr/bin/java).

      Selection      Path                                            Priority   Status
    
        0           /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      auto mode
    
        1           /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual mode
    
        2            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java  1051      manual mode
    
    
      Press enter to keep the current choice[*], or type selection number:
    

    I enter 2 as I want to use java 1.7.0_21

提交回复
热议问题