• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error occured in maven compilation

 
reubin haz
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using maven to compile a sample project, and I got this error:

package javax.annotation does not exist

I googled it and people says it's not using the correct Java version, it should use java 5, or later.
Then I checked my machine:

-bash-3.2$ javac -version
javac 1.6.0-internal

-bash-3.2$ mvn -version
Apache Maven 2.2.1 (r801777; 2009-08-06 15:16:01-0400)
Java version: 1.5.0_16
Java home: /usr/java/jdk1.5.0_16/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.18-164.15.1.el5" arch: "i386" Family: "unix"


It looks like I'm using the correct Java version. Why maven is still complain about it?

Thanks.


 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like you have two different Java installations. What do you have JAVA_HOME set to? Try running:

$JAVA_HOME/bin/java -version

I suspect that you 1.6 version is not a valid version, I certainly do not recognize the output from "javac -version".

Also, using 1.5 is not sufficient - it does not include the javax.annotation package.

My suggestion would be to install JDK 1.6 from Sun (or I guess it is Oracle now) and set JAVA_HOME to reference that. Then run mvn again.
 
reubin haz
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the reply, I reinstalled jdk with 1.6, now its compiling.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic