I am trying to compile a program using maven in my Linux 12.04. In order to do, I use the mvn clean install
command. However I get a build error:
[ERROR] Unable to locate the Javac Compiler in:
/usr/lib/jvm/java-6-openjdk-amd64/jre/../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.
I check the path and indeed I am missing that critical file. This is what I have:
user@modelX:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib$ ls
accessibility.properties im net.properties
amd64 images psfontj2d.properties
calendars.properties jar.binfmt psfont.properties.ja
charsets.jar javazic.jar resources.jar
classlist jce.jar rhino.jar
cmm jexec rt.jar
compilefontconfig.jar jsse.jar security
content-types.properties jvm.hprof.txt sound.properties
currency.data logging.properties swing.properties
ext management tz.properties
flavormap.properties management-agent.jar zi
fontconfig.properties meta-index
So apparently, I am running openJDK, but I am missing files. How do I fix this?
Apparently I was missing some important packages. I found the solution in this website: