You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "kramer.newsreader" <kr...@gmail.com> on 2008/12/21 10:51:58 UTC

[Newbie] Maven can't find javac

because it isn't looking in the right place.

I have more than one jvm installed.

[code]
$mvn install

Unable to locate the Javac Compiler in:
  /usr/lib/jvm/java-6-openjdk/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.

[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Sun Dec 21 01:43:23 PST 2008
[INFO] Final Memory: 10M/24M
[INFO] -----------------------------------------------
$ echo $JAVA_HOME
/usr/lib/jvm/java-6-sun
[/code]

Not sure why it's looking in the wrong place.

I am running mvn on Ubuntu Linux and yes, the tools jar does live under
/usr/lib/jvm/java-6-sun.

Any help would be appreciated.  Thanks.
-- 
View this message in context: http://www.nabble.com/-Newbie--Maven-can%27t-find-javac-tp21113688p21113688.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [Newbie] Maven can't find javac

Posted by Brett Porter <br...@apache.org>.
did you export JAVA_HOME so that it is using the right version?

- Brett

On 21/12/2008, at 8:51 PM, kramer.newsreader wrote:

>
> because it isn't looking in the right place.
>
> I have more than one jvm installed.
>
> [code]
> $mvn install
>
> Unable to locate the Javac Compiler in:
>  /usr/lib/jvm/java-6-openjdk/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.
>
> [INFO]
> ------------------------------------------------------------------------
> [INFO] For more information, run Maven with the -e switch
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 2 seconds
> [INFO] Finished at: Sun Dec 21 01:43:23 PST 2008
> [INFO] Final Memory: 10M/24M
> [INFO] -----------------------------------------------
> $ echo $JAVA_HOME
> /usr/lib/jvm/java-6-sun
> [/code]
>
> Not sure why it's looking in the wrong place.
>
> I am running mvn on Ubuntu Linux and yes, the tools jar does live  
> under
> /usr/lib/jvm/java-6-sun.
>
> Any help would be appreciated.  Thanks.
> -- 
> View this message in context: http://www.nabble.com/-Newbie--Maven-can%27t-find-javac-tp21113688p21113688.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

--
Brett Porter
brett@apache.org
http://blogs.exist.com/bporter/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [Newbie] Maven can't find javac

Posted by Jaikiran <ja...@yahoo.co.in>.
What does your pom.xml look like? Try adding the compiler plugin to your pom
with the following configuration:

<build>
    <plugins>

      <!-- Compiler -->
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <executable>${JAVA_HOME}/bin/javac</executable>          
        </configuration>
      </plugin>
...
-- 
View this message in context: http://www.nabble.com/-Newbie--Maven-can%27t-find-javac-tp21113688p21113760.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [Newbie] Maven can't find javac

Posted by Barrie Treloar <ba...@gmail.com>.
On Sun, Dec 21, 2008 at 8:21 PM, kramer.newsreader
<kr...@gmail.com> wrote:
>
> because it isn't looking in the right place.
>
> I have more than one jvm installed.
>
> [code]
> $mvn install

Find the mvn shell script and have a look under the covers.

Alternatively start it with <shell> -x /path/to/mvn
(where <shell> is whatever shell the mvn shell defined #! at the top)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org