i created a webapp project using maven in eclipse. when i run the command mvn package in command prompt it showing folowing error.
[ERROR] COMPILATION ERROR
In my case, the error "No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK" was due to the JRE being installed in a different location than its default under the JDK.
Running under 64-bit linux, I have Oracle's 64-bit JDK SE 1.6.0_45 installed at /opt/java
. The 32 and 64 bit JRE's were installed at /opt/java/jre32
and /opt/java/jre64
, with a jre symlink: (ie. ln -s jre64 jre
), sojre ->
./jre64(meaning
/opt/jdk/jrewas a symlink referencing
/opt/jdk/jre64).
Once I renamed jre64 to jre (ie. rm jre ; mv jre64 jre ; ln -s jre jre64
), this problem went away; and I was able to build using maven (inside of netbeans).
Maven appears to be looking at the JRE path, saying "jre64 isn't the correct name for a default JRE-inside-of-JDK install, so assume a JDK doesn't exist at ../"), which would prevent it from resolving the location of the JDK lib directory containing tools.jar, etc.
Haven't tested it, but the same thing might happen under Windows if the JRE isn't in the default location (or perhaps isn't in the %JAVA_HOME%\jre
directory). If both the JDK and the JRE are installed, Oracle's installer wants to install the JRE at %JAVA_HOME%\jre6
, not %JAVA_HOME%\jr
e. That may be because the \jre
directory is needed for the JDK uninstall process; if the JRE has been installed on top of the JDK's JRE in the \jre
directory, instead of at \jre
6, uninstalling the JDK after the uninstalling the JRE will fail unless the \jre directory is copied, JRE is uninstalled, and the \jre
copy is restored to \jre
.