M2E (Maven Eclipse) appears unable to compile when running some commands (unable to locate the Javac Compiler in:) __java

Source: Internet
Author: User

build errors for spider; Org.apache.maven.lifecycle.LifecycleExecutionException:Failed to execute goal org.apache.maven.plugins: Maven-compiler-plugin:2.3.2:compile (Default-compile) on project spider:compilation failure
Unable to locate the Javac Compiler in:
C:\Program files\java\jre6\. \lib\tools.jar
Please ensure your are using JDK 1.4 or above and
Not a JRE (the Com.sun.tools.javac.Main class is required).
In most cases/can change the location of your Java
Installation by setting the JAVA_HOME environment variable.

In fact, before the environment has encountered this problem, but eclipse or maven in the JRE environment when the choice of errors, the general solution is to replace the default JRE in eclipse with the JDK JRE

The method is as follows: Window-->preferences-->java-->installed JREs

Here you will see that there is a default, and then you click Add on the right ... to add a new standard VM,JRE home Select the JRE directory below your JDK, and when you're done, set him as the default. Then, you click on the installed JREs menu, there is a execution environments, the javase you use to set up.

The other solution is to add two lines to the Eclipse startup configuration file.

-vm

C:\Program Files\java\jdk1.6.0_45\bin\javaw.exe

There are two lines to write and one to write before the-vmargs.

In some cases, the reason for the problem is the coding problem, set up coding, Engineering coding, Java file encoding, etc...

Just yesterday when I encountered this problem, these methods have tried, but still error, MAVEN project can not compile. Then I check the environment variable configuration problem, found that there are no errors, input java-version, mvn-version, can display the normal version information. But when I delete the java_home, I enter the java-version, or display the normal version information, this is wrong, but I did not set the Java PATH environment variable AH. But all the Java and MAVEN environment variables are deleted, reconfigured again, and sure enough to open the Eclipse compiler project, running normally.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.