i am having this issue. I saw many posts like this but i still can't solve this problem. This error appears when i put mvn release:prepare at the shell
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3:compile (default-compile) on project birthday-greeting-card-sender: Compilation failure
[INFO] [ERROR] Unable to locate the Javac Compiler in:
[INFO] [ERROR] /usr/lib/jvm/java-6-openjdk-amd64/jre/../lib/tools.jar
[INFO] [ERROR] Please ensure you are using JDK 1.4 or above and
[INFO] [ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
[INFO] [ERROR] In most cases you can change the location of your Java
[INFO] [ERROR] installation by setting the JAVA_HOME environment variable.
[INFO] [ERROR] -> [Help 1]
[INFO] [ERROR]
[INFO] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[INFO] [ERROR]
[INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
I have set JDK at /usr/lib/jvm/java-7-openjdk-amd64 (Preferences-->Java-->Installed JRE). I also add this line into eclipse.ini, but it couldn't work either:
-vm /usr/lib/jvm/java-7-openjdk-amd64
Does anybody have an idea about what is going on?
Since you also have this problem while running mvn in the shell, this is not related to eclipse, so setting:
-vm /usr/lib/jvm/java-7-openjdk-amd64
won't have any effect.
This is also unrelated to the execution of goal release:prepare
as the error occurs at compilation time. You can probably reproduce the same error by doing mvn compile
.
Your JAVA_HOME is probably pointing to /usr/lib/jvm/java-6-openjdk-amd64
(as seen in mvn log) while your jdk resides in /usr/lib/jvm/java-7-openjdk-amd64
.
To change JAVA_HOME and test the new setting, go in a shell and:
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
mvn compile
If it works you can add export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
to your ~/.bashrc
file so that it gets set everytime.