This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes error occured in maven compilation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "error occured in maven compilation" Watch "error occured in maven compilation" New topic
Author

error occured in maven compilation

reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
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.



SCJA, SCJP5.0, SCBCD, SCWCD
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

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.


JBoss In Action
reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
thanks for the reply, I reinstalled jdk with 1.6, now its compiling.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error occured in maven compilation