Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I already exported JAVA_HOME to the directory of jdk
Code:
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
but when I tried mvn --version to test if the Apache maven was successfully installed, I got this error message:
Code:
Error: JAVA_HOME is not defined correctly.
We cannot execute /usr/share/doc/sun-java5-jre/JAVA_HOME5-jre/JAVA_HOME5-jre/JAVA_HOME5-jre/JAVA_HOME5-jre/JAVA_HOME/bin/java
what is this mvn you are executing?
Obviously, it is setting its own JAVA_HOME.
That was the installation process of Apache Maven.
Let me tell you the instructions:
1. Extract the distribution archive, i.e. apache-maven-2.0.9-bin.tar.gz to the directory you wish to install Maven 2.0.9. These instructions assume you chose /usr/local/apache-maven. The subdirectory apache-maven-2.0.9 will be created from the archive.
2. In a command terminal, add the M2_HOME environment variable, e.g. export M2_HOME=/usr/local/apache-maven/apache-maven-2.0.9.
3. Add the M2 environment variable, e.g. export M2=$M2_HOME/bin.
4. Optional: Add the MAVEN_OPTS environment variable to specify JVM properties, e.g. export MAVEN_OPTS="-Xms256m -Xmx512m". This environment variable can be used to supply extra options to Maven.
5. Add M2 environment variable to your path, e.g. export PATH=$M2:$PATH.
6. Make sure that JAVA_HOME is set to the location of your JDK, e.g. export JAVA_HOME=/usr/java/jdk1.5.0_02 and that $JAVA_HOME/bin is in your PATH environment variable. 7. Run mvn --version to verify that it is correctly installed.
Can you tell me the correct way to set JAVA_HOME and so as the PATH? Coz I'm really confused. Thank you so much.
When I tried the command below it says "No such file or directory". The Apache Maven was located on /usr/local/apache-maven-2.0.9
Code:
/opt/apache-maven/bin/mvn --version
The things is, the JAVA_HOME was located on /usr/share/doc/sun-java5-jre which I think it should be located on where jdk is (if I'm not mistaken). The jdk was located on /usr/lib/jvm/java-1.5.0-sun
I am wondering:
- why do you need Apache maven ? What do you intend to do with it ?
- why didn't you get it as a package for your distribution ?
- (take no offense) knowing that you don't know how to export a BASH environment variable neither how-to include a path in your PATH environment variable, how are you going to effectively use Apache maven ?
I issued following command: '/opt/apache-maven/bin/mvn --version' because I knew where the 'mvn' program was on *my* system.
Otherwise please send output of : 'set|grep JAVA' and 'echo $PATH' commands (typed without the quotes).
I'm sorry, honestly it was my first time to use linux commands so please bear with me. I need to install Apache Maven because it was a required software for the portal server.
It would be helpful if you mentioned the type of distribution you are using. Many of the ones that come with a package manager will set up the path automatically and can install maven from their repositories.
It would be helpful if you mentioned the type of distribution you are using. Many of the ones that come with a package manager will set up the path automatically and can install maven from their repositories.
I'm using Debian.
I am installing Debian-based portal server which requires me to install Apache Maven first before to go through the portal installation.
OK, now install maven using apt-get install maven2. You may want to check first whether it is actually available (command = aptitude search maven) but I can hardly imagine that it is not.
You may need to remove the paths that you set manually; unless you have a different jdk as your default, installing jdk5 should have taken care of this part.
OK, now install maven using apt-get install maven2. You may want to check first whether it is actually available (command = aptitude search maven) but I can hardly imagine that it is not.
You may need to remove the paths that you set manually; unless you have a different jdk as your default, installing jdk5 should have taken care of this part.
I don't know how to recover the changes I made in /etc/profile.
I really had a wrong move..so now when I used "vi /etc/profile",
I got this:
Code:
E325: ATTENTION
Found a swap file by the name "/etc/.profile.swp"
owned by: root dated: Wed Jan 28 11:53:05 2009
file name: /etc/profile
modified: YES
user name: root host name: gridport.psigrid.gov.ph
process ID: 23578
While opening file "/etc/profile"
dated: Wed Jan 28 17:15:53 2009
NEWER than swap file!
(1) Another program may be editing the same file.
If this is the case, be careful not to end up with two
different instances of the same file when making changes.
Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r /etc/profile"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "/etc/.profile.swp"
to avoid this message.
"/etc/profile" 67 lines, 605 characters
Press ENTER or type command to continue
Code:
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
fi
if [ "$PS1" ]; then
if [ "$BASH" ]; then
PS1='\u@\h:\w\$ '
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
export PATH
unmask 022
On which part of the above script I'll going to add for the setting up of JAVA_HOME??
You just add your export JAVA_HOME to the bottom of /etc/profile. As for the first excerpt you posted, that is the message you would get if your vim session crashed. It tells you that a copy of the original file has been made and that you need to decide what to do with it. See the information under (2) in the message.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.