No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
来源:互联网 发布:sql create table 编辑:程序博客网 时间:2024/05/10 13:23
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
I'm compiling a project in Eclipse using m2eclipse. I set the jdk path in eclipse like this:
Windows-->preferences-->installed jres--> jdk1.7.xx path
but this is showing error
[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[INFO] -------------------------------------------------------------[INFO] ------------------------------------------------------------------------[INFO] BUILD FAILURE[INFO] ------------------------------------------------------------------------[INFO] Total time: 1.424s[INFO] Finished at: Tue Oct 29 15:21:01 IST 2013[INFO] Final Memory: 5M/15M[INFO] ------------------------------------------------------------------------[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler- plugin:3.1:compile (default-compile) on project TEST-WEB: Compilation failure[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
10 Answers
Go into Window > Preferences > Java > Installed JREs > and check your installed JREs. You should have an entry with a JDK there. Select the Execution Env as show below. Click OK
Then RightClick Project -> Maven -> Update Project
For me, it is exactly what the maven of eclipse complains
So, I press Edit
button and change path to the JDK Folder, then clean project and everything starts to work
Installed JREs
instead of jdk folder. But It really solved me problem. Thanks – Joe.wang Jan 13 at 2:40For me, nothing worked until I made this change to my pom.xml:
<build>... <plugins> ... <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <fork>true</fork> <executable>C:\Program Files\Java\jdk1.7.0_45\bin\javac.exe</executable> </configuration> </plugin> </plugins></build>
Other Notes
I could see that m2e was executing in a JRE, not the JDK. Nothing I did changed this, including adding this to the eclipse.ini:
-vmC:\Program Files\Java\jdk1.7.0_45\bin\javaw.exe
In the end I never got m2e to execute in a JDK, but setting the Java compiler explicitly (as above) did the trick.
- Set JAVA_HOME to JDK root - required if you run command line or maven(google for this variable)
- In project properties in section Java Compiller select required JDK - if you run directly from eclipse
I was getting this error when trying to do a maven build from within eclipse.
For me, the answer was going to Run
-> Run Configurations
, selecting the Maven Build
I was running (from the left panel). Then, I clicked the JRE
tab and selected the option Workspace default JRE
There is another possible answer to this question, and I may be the only person foolish enough to have stumbled upon this, but I think it's worth adding, since none of the other answers applied as I already had those settings correct.
When you install a JDK, the installer asks you where you want to install the files. By default, on Windows, this is something like C:\Program Files\Java\jdk1.8.0_74 (or whatever version you are installing).
It then asks you for a directory to install the JRE to, which by default is something like C:\Program Files\Java\jre1.8.0_74.
Note that one is jdk1.8.0_74 and the other is jre1.8.0_74
I was rushing things, and thinking the installer was asking me the same question twice, set both my JDK and JRE install locations to D:\devtools\jdk\jdk1.8.0_74, resulting in the installer overwriting the JDK with the JRE. This resulted in (among other things) a missing javac.exe in my JDK bin, and the same error the OP reported here in all my maven builds.
An alternative if jaipster's answer does not work is to go to:
Window > Preferences > Java > Installed JREs
Then to edit the jre so that it points to the jdk and not the jre (the jre home filed in the jre package editor)
That worked for me.
Try this.
... ... maven-compiler-plugin 3.1 true path to jdk \bin\javac.exe
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 问题
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 问题
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 问题
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 问题
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- 242. Valid Anagram
- protocol和delegate
- ios UIImageView详解
- 优先队列
- 学习mysql比较好一些书籍
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- php7—mysql—apache配置
- 线性模型
- virtualbox+Ubuntu网络连接思路
- mysql 服务启动error:1067错误
- Effective C++学习记录
- iOS请求数据两种方式(GET、POST)
- 代码重构-重新组织函数
- 毕业设计第六天