[ https://jira.codehaus.org/browse/MCOMPILER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=300348#comment-300348 ]
Mike Hansen commented on MCOMPILER-104: --------------------------------------- I have this problem too and unfortunately, my situation doesn't seem as simple to solve as #sombriks. I'm using command-line mvn, but I also see this in netbeans. I get the same error and I also use Slackware (13.37). My JAVA_HOME is set to /usr/lib/java, which is a JDK and has a "jre" subdirectory (I'm using the 'real' Oracle jdk 1.6). >From the error message, it seems the java compiler plugin (not forked) is >expecting JAVA_HOME to be set to the JRE which would be /usr/lib/java/jre. If >that were the case, /usr/lib/java/../lib/tools.jar would indeed resolve >correctly. So that is one work-around, but I don't see why I would need to >set my JAVA_HOME to the jre location to make things work and I don't want to >set it to the JRE. I've looked all around in the mvn script and settings files and I can't find anywhere that it might even hint at putting in this ".." or expecting JAVA_HOME to be the jre. When I type 'which java', I get /usr/lib/java/bin/java, which is indeed my jdk. It isn't a symlink and I have no symlink for java in /usr/bin. When I type 'mvn --version' it shows my proper JAVA_HOME value as I'd expect. Another workaround is to configure the compiler plugin in my pom file and set the executable location to ${JAVA_HOME}/bin/java, and that works fine. But I'm very curious to understand why the default settings cause this problem. Here is the compiler configuration I'm using in my POM, with the work-around commented out: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <!-- <fork>true</fork> <executable>${JAVA_HOME}/bin/javac</executable> --> <source>${java-version}</source> <target>${java-version}</target> </configuration> </plugin> Any ideas what could be going on here? > JAVA_HOME pointing to JDK but /usr/lib/java/../lib/tools.jar being used > ------------------------------------------------------------------------- > > Key: MCOMPILER-104 > URL: https://jira.codehaus.org/browse/MCOMPILER-104 > Project: Maven 2.x Compiler Plugin > Issue Type: Bug > Affects Versions: 2.0.2 > Environment: Linux sombriks 2.6.24.5-smp #2 SMP Wed Apr 30 13:41:38 > CDT 2008 i686 Intel(R) Core(TM)2 Duo CPU E4500 @ 2.20GHz GenuineIntel > GNU/Linux > java version "1.6.0_10" > Java(TM) SE Runtime Environment (build 1.6.0_10-b33) > Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode) > echo $JAVA_HOME > /usr/lib/java > which javac > /usr/lib/java/bin/javac > Reporter: sombriks > > using command line or netbeans plugin it's happening: > leonardo@sombriks:~/NetBeansProjects/arena/arena-client$ mvn compile > [INFO] Scanning for projects... > [INFO] > ------------------------------------------------------------------------ > [INFO] Building Arena PUJ Client (jar) > [INFO] task-segment: [compile] > [INFO] > ------------------------------------------------------------------------ > [INFO] [resources:resources {execution: default-resources}] > [WARNING] Using platform encoding (ISO-8859-1 actually) to copy filtered > resources, i.e. build is platform dependent! > [INFO] Copying 0 resource > [INFO] [compiler:compile {execution: default-compile}] > [INFO] Compiling 1 source file to > /home/leonardo/NetBeansProjects/arena/arena-client/target/classes > [INFO] > ------------------------------------------------------------------------ > [ERROR] BUILD FAILURE > [INFO] > ------------------------------------------------------------------------ > [INFO] Compilation failure > Unable to locate the Javac Compiler in: > /usr/lib/java/../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. > [INFO] > ------------------------------------------------------------------------ > [INFO] For more information, run Maven with the -e switch > [INFO] > ------------------------------------------------------------------------ > [INFO] Total time: 3 seconds > [INFO] Finished at: Wed Aug 19 11:10:59 BRT 2009 > [INFO] Final Memory: 9M/65M > [INFO] > ------------------------------------------------------------------------ > leonardo@sombriks:~/NetBeansProjects/arena/arena-client$ -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira