2
0

【eclipse】Spring bootでバージョンが違うというエラーが出た(java.lang.UnsupportedClassVersionError)

Posted at

JavaのSpring bootでWebアプリを開発していたら下のようなエラーが発生。

エラー: メイン・クラスcom.example.demo.~のロード中にLinkageErrorが発生しました
java.lang.UnsupportedClassVersionError: com/example/demo/~ has been compiled by a more recent version of the Java Runtime (class file version 66.0), this version of the Java Runtime only recognizes class file versions up to 65.0

【原因】build.gradleで指定しているバージョンがJavaのバージョンと異なる

  1. Javaのバージョンを確認
    Eclipseのメニューから[設定]を選択→[Java]-[インストール済みのJRE]を選択
    チェックの付いているJavaのバージョンを確認。

  2. build.gradleで正しいJavaのバージョンを指定
    java {
    sourceCompatibility = 'ここを変更'
    }

参考

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0