Eclipse Maven Plugin Configuration Problem

筅森魡賤 提交于 2019-11-30 19:12:24

It appears that Eclipse is still referring to a JRE instead of a JDK. Also, the default runtime in Eclipse (found in the "Installed Runtimes" page of the Preferences dialog) might be a JRE.

I've noticed that this sometimes occurs due to multiple VM configurations being obtained, with the first or the last being applied. You can confirm whether this is the case (in Helios), by going to the About page of Eclipse, and then viewing the Configuration tab in Installation Details. Usually the culprit turns out to be a missing new line in eclipse.ini.

Perhaps you are reusing a "Run configuration" you did when the JRE was set up outside the JDK. Create a new "Run Configuration", making sure that the tab is indicated Java JDK.

Try setting JAVA_HOME to JDK and not to JRE ?

z8888q

When you created your Maven project with Eclipse, maybe the text file encoding of your project's properties and the project.build.sourceEncoding in your pom.xml were not the same. If that's the case, then when you built the project, you'd get the error

"Unable to locate the Javac Compiler in:..."

For example, my text file encoding was GBK, and my project.build.sourceEncoding was UTF-8. I just modified my text file encoding to UTF-8, and everything was OK!

I had also this kind of problems.

In my case it turned out that JAVA_HOME was defined for my user only while PATH was set for the system and maven plugin used default JRE instead of JDK. So make sure that JAVA_HOME and PATH are in the same scope (I put both variables for system and added JAVA_HOME as the first part in PATH).

Hope it helps someone.

Note the format of the -vm option - it is important to be exact:

The -vm option and its value (the path) must be on separate lines. The value must be the full absolute path to the Java executable, not just to the Java home directory. The -vm option must occur before the -vmargs option, since everything after -vmargs is passed directly to the JVM.

venkatram mutyala

If all the environments are fine and you are still getting build errors then the final approach is to set JAVA_HOME as JDK 1.5 or above. Then build the project from the command prompt. The build should be successful.

You could try updating the JDK Eclipse is using, as follows, and it works:

Add and set the JRE in Window->Preferences...->Java->Installed JREs:

JRE type: Standard VM JRE 
Name: jdk1.6.0_18
JRE home directory: C:\Program Files (x86)\Java\jdk1.6.0_18

If this is not the case, it's possible that the brackets and spaces in the JAVA_HOME path are causing issues. Try copying your JDK to a different location and updating your JAVA_HOME.

Blockquote

TO CONVERT JRE TO JDK:

->Goto windows ->Preferences ->type as installed JRE's in the left top searchbox ->click installed JRE's ->select add from the right dialogBox ->click standard vm ->select the directory for "JREHOME" and do the following "C:\ProgramFiles\java\jdk1.8.0_131" ->then type as jdk1.8.0_131 "JRE NAME" ->click finish.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!