No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

后端 未结 30 2177
盖世英雄少女心
盖世英雄少女心 2020-11-22 15:40

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  p         


        
相关标签:
30条回答
  • 2020-11-22 16:28

    I got same issue and i just add JAVA_HOME to environment variables.

    • If you are using eclipse, just refer https://stackoverflow.com/a/21279068/6097074
    • If you are using intellij, just after adding JAVA_HOME open command prompt from project directory and run mvn clean install(don't use intellij terminal).
    0 讨论(0)
  • 2020-11-22 16:29

    I did the following change and it worked for me.Hope it helps someone.

    0 讨论(0)
  • 2020-11-22 16:30

    Try this.

    <build>
    ...
        <plugins>
        ...
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <fork>true</fork>
                    <executable> path to jdk \bin\javac.exe</executable>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
    0 讨论(0)
  • 2020-11-22 16:30

    In Windows 7 - 64 bit, there is a permissions problem which prevents the installer from unpacking the file C:\Program Files\Java\jdk1.6.xx\lib\tools.jar into your local. This jar file is what maven-compiler-plugin version 3.x uses instead of the usual javac

    Solution: Run, as an administrator, the Java JDK installer! And make sure the tools.jar is sitting in the C:\Program Files\Java\jdk1.6.xx\lib\

    In case you are using m2e maven integration plugin, you want to see the file is visible to Eclipse via the following steps inside Eclipse:

    Go to Window -> Preferences -> Java -> installed JREs Select the JDK you are using (C:\Program Files\Java\jdk1.6.xx) Press Edit to see the list of jars including tools.jar, OR you can add it as Add External JAR Then configure the maven run through these steps:

    Run->Run configurations->Fill in Name, Base directory and Goals. Then in the same window move to the JRE tab and point to the JDK \jdk1.6.xx\

    0 讨论(0)
  • 2020-11-22 16:31
    1. On your Eclipse IDE, go into Window > Preferences > Java > Installed JREs > and check your installed JREs. You should have an entry with a JDK there.
    2. Select the Execution Env as show below. Click OK
    3. Then Right-Click on your Project -> Maven -> Update Project

    Additionally, you may have to change Maven JRE (see @jlars62 answer) which is as follows. Goto 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

    0 讨论(0)
  • 2020-11-22 16:31

    For me the JRE was in the PATH environment variable before the JDK path

    1. C:\ProgramData\Oracle\Java\javapath
    2. C:\env\jdk1.8.0_151\bin

    So I removed 1. Probably swapping them would fix it too.

    0 讨论(0)
提交回复
热议问题