Problems related to building a maven environment in XP: Unable to locate the Javac Compiler in: C: \ Program Files \ Java \ jre6 \ .. \ lib \ tools. jar

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 you are using JDK 1.4 or above and
Not a JRE (the com. sun. tools. javac. Main class is required ).
In most cases you can change the location of your Java
Installation by setting the JAVA_HOME environment variable.

In fact, this problem was also encountered during the previous setup of the environment, except that eclipse or maven chose an error when using the jre environment, the general solution is to replace the default jre with jdk jre in eclipse.

The method is as follows: window --> Preferences --> java --> Installed JREs

Here you will see a default, and then you click Add... on the right ..., add a new Standard VM, and select the JRE directory under your JDK as jre home. After that, set it as the default. Then, click the sub-menu of Installed JREs, there is a Execution Environments, set the javase you use.

Another solution is to add two lines in the eclipse STARTUP configuration file.

-Vm

C: \ Program Files \ Java \ jdk1.6.0 _ 45 \ bin \ javaw.exe

It should be written in two lines, or before-vmargs.

In some cases, the cause of the problem may be encoding. Set the encoding, engineering encoding, and java file encoding ..

I tried these methods when I encountered this problem yesterday, but I still reported an error. The maven project cannot be compiled. Then I checked the environment variable configuration and found that there was no error. The normal version information can be displayed by inputting java-version and mvn-version. However, when I deleted JAVA_HOME, I entered java-version again to display the normal version information. This is incorrect, but I didn't set the java path environment variable. Instead, you can delete all the java and maven environment variables, reconfigure them, and then open the eclipse compilation project to run normally.

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.