Install and configure JAVA + MAVEN in Ubuntu 14.04
It's pretty easy to install and configure JAVA + MAVEN in Ubuntu 14.04 following these steps:
1. Install OpenJDK 7:
$ sudo apt-get install icedtea-7-plugin openjdk-7-jre openjdk-7-jdk
Check the installed java:
$ java -version
It will show something like:
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.6) (7u51-2.4.6-1ubuntu4)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
2. Configure JAVA_HOME environment variable:
$ sudo nano /etc/environment
$ source /etc/environment
JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
1. Install OpenJDK 7:
$ sudo apt-get install icedtea-7-plugin openjdk-7-jre openjdk-7-jdk
Check the installed java:
$ java -version
It will show something like:
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.6) (7u51-2.4.6-1ubuntu4)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
2. Configure JAVA_HOME environment variable:
- Open the /etc/environment file:
$ sudo nano /etc/environment
$ source /etc/environment
- Add this line:
JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
- Open ~/.bashrc:
$ sudo nano ~/.bashrc
- Add these lines to the end of the file:
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
$ source ~/.bashrc
3. Install Maven:
$ sudo apt-get install maven
Check the installed maven's version:
$ mvn -version
It will show something like:
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-24-generic", arch: "amd64", family: "unix"
4. Done
I got the following error while installing Maven on my Ubuntu (3.13.0-48-generic) on ARM64:
ReplyDeleteGet:252 http://ports.ubuntu.com/ubuntu-ports/ trusty/main gdisk arm64 0.8.8-1build1 [182 kB]
Err http://ports.ubuntu.com/ubuntu-ports/ trusty-security/main libtiff5 arm64 4.0.3-7ubuntu0.1
404 Not Found
Fetched 86.6 MB in 1min 27s (994 kB/s)
E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/t/tiff/libtiff5_4.0.3-7ubuntu0.1_arm64.deb 404 Not Found
In the above location there is a newer version of this lib:
libtiff5_4.0.3-7ubuntu0.3_arm64.deb
Is there a way to fix this?
It's because the default repository of your Ubuntu version does not contain Apache Maven package. Are you trying to install Maven on a Raspberry Pi or st? If so, please read this article: http://peterwawood.blogspot.com/2014/07/installing-java-ant-and-maven-on.html. Basically, you install Apache Maven manually by downloading the package and config the right PATH.
ReplyDeleteI am trying to install Maven on Ubuntu (Linux 3.13.0-48-generic #80-Ubuntu SMP aarch64 GNU/Linux) that is running on ARM64 processor. Where Raspbery, on my understanding, is on a different platform (ARM).
ReplyDeleteWhat you said regarding the default repository makes sense because when I tried to install maven using the command specified in the article the apt-get tried to bring in many handlreds of packages that, I know, have no relation to Maven whose dependnecy is very concise.
So I guess, you have to Download the Apache Maven package and install it manually. Anyway, your question is helpful for my future reference.
ReplyDelete