Find maven version and install MAVEN_HOME in ubuntu

I think I mixed something up. Yesterday everything worked fine. Today you have a lot of problems.

1. I ran this command

echo $JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64/ 

then

 mvn --version Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher 

It worked fine yesterday (returning the maven version, 3.0.4, I think). Now this has begun to create problems. what to do?

  1. Also after launch

    $ java --version Unrecognized option: --version Failed to create Java virtual machine.

here is the contents of my .bashrc file and I have nothing in the / etc / environment file.

 PATH=$PATH:$HOME/.rvm/ JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/ export JAVA_HOME PATH=$PATH:$JAVA_HOME export PATH 

and this is in my / etc / profile

 JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/ PATH=$PATH:$HOME:$JAVA_HOME/bin export JAVA_HOME export PATH 
  1. Also let me know how I can set MAVEN_HOME in it.

Any help would be greatly appreciated. Thanks:)

+5
source share
3 answers

Perhaps my configuration gives you a hint:

 /$ uname -a Linux jenkins 3.2.0-55-generic #85-Ubuntu SMP Wed Oct 2 12:29:27 UTC 2013 \ x86_64 x86_64 x86_64 GNU/Linux /$ echo $PATH /var/lib/jenkins/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin /$ ls -l /usr/bin/java* / usr/bin/mvn* lrwxrwxrwx 1 root root 22 Feb 21 2013 java -> /etc/alternatives/java lrwxrwxrwx 1 root root 23 Feb 21 2013 javac -> /etc/alternatives/javac lrwxrwxrwx 1 root root 24 Feb 21 2013 javaws -> /etc/alternatives/javaws lrwxrwxrwx 1 root root 21 Feb 21 2013 mvn -> /etc/alternatives/mvn lrwxrwxrwx 1 root root 26 Feb 21 2013 mvnDebug -> /etc/alternatives/mvnDebug /$ ls -l /etc/alternatives/java* /etc/alternatives/mvn* lrwxrwxrwx 1 root root 17 May 31 2013 /etc/alternatives/java -> \ /opt/jdk/bin/java lrwxrwxrwx 1 root root 18 May 31 2013 /etc/alternatives/javac -> \ /opt/jdk/bin/javac lrwxrwxrwx 1 root root 58 Feb 21 2013 /etc/alternatives/javaws.1.gz -> \ /usr/lib/jvm/java-6-openjdk-amd64/jre/man/man1/javaws.1.gz lrwxrwxrwx 1 root root 24 Feb 21 2013 /etc/alternatives/mvn -> \ /usr/share/maven/bin/mvn lrwxrwxrwx 1 root root 29 Feb 21 2013 /etc/alternatives/mvn.1.gz -> \ /usr/share/maven/man/mvn.1.gz lrwxrwxrwx 1 root root 29 Feb 21 2013 /etc/alternatives/mvnDebug -> \ /usr/share/maven/bin/mvnDebug lrwxrwxrwx 1 root root 34 Feb 21 2013 /etc/alternatives/mvnDebug.1.gz -> \ /usr/share/maven/man/mvnDebug.1.gz 

/usr/share/maven/conf/m2.conf :

 main is org.apache.maven.cli.MavenCli from plexus.core set maven.home default ${user.home}/m2 [plexus.core] optionally ${maven.home}/lib/ext/*.jar load ${maven.home}/lib/*.jar 

 /$ java -version java version "1.7.0_21" Java(TM) SE Runtime Environment (build 1.7.0_21-b11) Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode) /$ mvn -version Apache Maven 3.0.4 Maven home: /usr/share/maven Java version: 1.7.0_21, vendor: Oracle Corporation Java home: /opt/jdk1.7.0_21/jre Default locale: en_GB, platform encoding: UTF-8 OS name: "linux", version: "3.2.0-55-generic", arch: "amd64", family: "unix" 
+2
source

there was only one error that was java -version. It should be a java version (single dash) otherwise it works fine now ...

+1
source

http://www.johnlabarge.com/post/33156663109/dreaded-maven-error-could-not-find-or-load-main-class This link may help, just delete the M2_HOME variable and then add the M3_HOME variable.

By the way, there is no Java version for printing, you must enter java -version , not java --version , you need only one dash, but with Maven both "mvn -version" and mvn --version are fine.

0
source

Source: https://habr.com/ru/post/1205007/


All Articles