Maven3, Javac & Co. On Debian

apache-maven-project-2

Maven3 &the right JDK

I was trying to build Maven3, to build other stuff (hippo cms) and suddenly my system said:

BUILD FAILED
/usr/src/apache-maven-3.0.5/build.xml:223: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/java-6-openjdk-amd64/jre"

This means that I’m trying to compile Maven3 without having installed the JAVA SE jdk from Oracle website, but luky you, you can follow this link: [Download Java].

One negative thing is that you have to accept the software license and then you can just download the package within the same browser session, thus you have to SCP the tar.gz archive to your server machine. This is not lazy-sysadmin-friendly indeed. 😛

By the way what i’ve done in order to undertsand where and how this package should have been moved to work fine was to look around for already present java version on my system.
the command:

# which java

gives some info, mine gives:

/usr/bin/java

Then with

# ls -al /usr/bin/java 
lrwxrwxrwx 1 root root 22 Apr 27 10:10 /usr/bin/java -> /etc/alternatives/java

We see a link pointing in /etc/alternatives. Let’s have a look there:

# ls -al /etc/alternatives/java
lrwxrwxrwx 1 root root 46 Apr 27 10:10 /etc/alternatives/java -> /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java

Another link to /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java, and that is the place where to extract our downloaded archive, so

# mv /usr/src/jdk1.7.0_21 /usr/lib/jvm/
# cd /usr/lib/jvm/
# ls -al
total 32
drwxr-xr-x  5 root root  4096 May  4 08:44 .
drwxr-xr-x 46 root root 12288 Apr 27 14:24 ..
lrwxrwxrwx  1 root root    20 Mar  5 10:16 java-1.6.0-openjdk-amd64 -> java-6-openjdk-amd64
-rw-r--r--  1 root root  2387 Mar  5 10:16 .java-1.6.0-openjdk-amd64.jinfo
drwxr-xr-x  5 root root  4096 Apr 27 10:05 java-6-openjdk-amd64
drwxr-xr-x  3 root root  4096 Apr 27 10:05 java-6-openjdk-common
drwxr-xr-x  8 uucp  143  4096 Apr  4 11:32 jdk1.7.0_21

Here we are!. You can see in red (last line of previous code snippet) our jdk dir. The one in blue is the one in use (I don’t know why it is linking somenthing in the same directory…) So,

# cd /etc/alternatives
# ls -al java
lrwxrwxrwx 1 root root 46 Apr 27 10:10 java -> /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java
# rm java
ln -s /usr/lib/jvm/jdk1.7.0_21/jre/bin/java java

Then finally, I could go back into the maven3 source directory and build it with ant… After tons of output and after having downloaded the internet, it builds.

all:

BUILD SUCCESSFUL
Total time: 6 minutes 8 seconds 

(Visited 1,207 times, 1 visits today)

Author: Giuseppe Urso

Giuseppe lives in Haarlem now with his shiny dog, Filippa In 1982 received his first home computer, a Commodore 64, followed by Datasette and a 1541 Floppy Disk Drive. In 1999 he installed his first Linux distro (LRH6). In 2006 he switched to Debian as favourite OS. Giuseppe Urso actively sustains the Free Software Fundation and his founder Richard Mattew Stallman, he speaks to people trying to convince them to join the fight now, and about how important is to use Free Software only. He has a job as Infra Specialist at Hippo Enterprise Java Cms an Open Source Enterprise class Content Management System, one of the coolest company ever, in Amsterdam. He's always ready to install Debian on other people computers for free.

2 thoughts on “Maven3, Javac & Co. On Debian”

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.