LoginSignup
13
17

More than 5 years have passed since last update.

【問題解決】Maven Installで「No compiler is provided in this environment.」というエラーが発生

Last updated at Posted at 2017-12-30

環境

  • Eclipse Pleiades 4.7
  • Maven 3.3.9 (Eclipse pleiadesに組み込まれていたもの. EMBEDDED)
  • Java8
  • Spring Boot 1.5.7

問題

「Maven Install」でエラーが発生しました。

エラーが発生した操作

  1. Eclipseのプロジェクトを選択し、右クリック
  2. 「実行→Maven Install 」を選択

エラー内容

コンソールに「No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?」というメッセージが表示されました。

console
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ demo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to C:\MyProgram\pleiades_4.7\workspace\demo\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error

原因

「Perhaps you are running on a JRE rather than a JDK?」というメッセージの通り、JREで実行していました。

image

また、Eclipseの「設定→Java→インストール済のJRE」を開き、パスを確認すると、JREのパス(C:\Program Files\Java\jre1.8.0_144)になっていました。

image

解決策

インストール済のJREのパスを、「JRE」でなく、「JDKフォルダ配下のJRE」に変更しました。

image

再度「Maven install」を実行したら、エラーは消えました。

ハマった原因

そもそも私はなぜ、JREのパスを設定していたのでしょうか?
たぶん、以下の項目が原因なんだと思います。

  • 「インストール済JRE」という名前から、「JREのパス」を設定すべきだと思っていた
  • JDKフォルダの中に、JREフォルダが存在することを知らなかった
  • JREのパスが設定されている状態で、今まで特に問題が起きなかった(Spring Bootなどが起動できた)

参考にしたサイト

よく分からないこと

  • 「JRE」と「JDK配下のJRE」の違い
  • 「JRE」が設定されている状態で、Spring Bootを起動できる理由
13
17
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
13
17