Resolving version conflict between java and javac on Ubuntu

后端 未结 5 1608
故里飘歌
故里飘歌 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:43

    You will also need to do:

    sudo update-alternatives --config javac
    

    Select the desired java compiler from the list provided. For example on Centos 5

    There are 2 programs which provide 'javac'.
    Selection    Command
    -----------------------------------------------
    1           /usr/lib/jvm/java-1.6.0-openjdk/bin/javac
    *+ 2        /usr/lib/jvm/java-1.7.0-openjdk/bin/javac
    

提交回复
热议问题