ant and java 8 - “major version 52 is newer than 51, the highest major version supported by this compiler”

前端 未结 4 2741
隐瞒了意图╮
隐瞒了意图╮ 2020-12-31 05:34

I am trying to upgrade my ant project from java 7 to java 8.
(the project deployed in \"Eclipse Kepler\" with \"Java™ 8 support to Eclipse Kepler SR2\")

For that

4条回答
  •  梦谈多话
    2020-12-31 06:11

    In Ubuntu, I simply fixed it by configure javah from jdk(either openjdk or oracle jdk works) 7 to 8:

    $ javah -classpath . -d jni/ NativeSorting
    ./NativeSorting.class: major version 52 is newer than 51, the highest major version supported by this compiler.
      It is recommended that the compiler be upgraded.
    $ sudo update-alternatives --config javah
    There are 4 choices for the alternative javah (providing /usr/bin/javah).
    
      Selection    Path                                         Priority   Status
    ------------------------------------------------------------
      0            /usr/lib/jvm/java-8-openjdk-amd64/bin/javah   1081      auto mode
    * 1            /usr/lib/jvm/java-7-openjdk-amd64/bin/javah   1071      manual mode
      2            /usr/lib/jvm/java-8-openjdk-amd64/bin/javah   1081      manual mode
      3            /usr/lib/jvm/jdk1.7.0_80/bin/javah            1000      manual mode
      4            /usr/lib/jvm/jdk1.8.0_131/bin/javah           1000      manual mode
    
    Press  to keep the current choice[*], or type selection number: 2
    update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/javah to provide /usr/bin/javah (javah) in manual mode
    $ javah -classpath . -d jni/ NativeSorting
    $ 
    

提交回复
热议问题