i installed apache-maven-3.0.4 on mac 10.6.8, the bin folder structure is like this:
/usr/share/java/maven-3.0.4/bin/
-- m2.conf
-- mvn
-- mvn.bat
-- mvnDebug
-- mvnDebug.bat
-- mvnyjp
if i run 'mvn -v' as non-root user, i get:
-bash: maven: command not found
if i run as a root user, i got:
Maven home: /usr/share/maven
Java version: 1.6.0_29, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.6.8", arch: "x86_64", family: "mac"
the same thing to 'mvnDebug', how can i fix this so that non-root user can access these commands? Thanks
You need to set PATH to include /usr/share/java/maven-3.0.4/bin/. And make sure that the modes the entire tree are something like 755.
Related
I am very new to Spark and attempting a first time install. I have downloaded homebrew and installed Maven with it.
I have run the following to ensure the install was done correctly:
Command: maven - v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
Maven home: /usr/local/Cellar/maven/3.3.9/libexec
Java version: 1.8.0_111, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.3", arch: "x86_64", family: "mac"
However, when I try to build spark using the following command:
./build/mvn -Pyarn -Phadoop-2.4 -Dhadoop.version=2.4.0 -DskipTests clean package
I get this error:
-bash: ./build/mvn: No such file or directory
UPDATE:
I went on to follow instructions on instaling Spark with Homebrew from here:
• https://medium.com/#josemarcialportilla/installing-scala-and-apache-spark-on-mac-os-837ae57d283f#.ru5hi42v3
This worked fine untill I restarted the terminal. When I execute
spark-shell
I get :
/usr/local/Cellar/apache-spark/2.1.0/libexec/bin/spark-shell: line 57: /usr/local/Cellar/apache-spark/2.0.1/libexec/bin/spark-submit: No such file or directory
Would appreciate any pointers in resolving this.
UPDATE
I have updated my .bash_profile to this.
Still getting the same error. However when I access the files directly by going to the folder via terminal, I can open it.
If the version of spark you installed is not 2.1.0, then you have to modify the line export SPARK_HOME= .... to correspond to version of spark you have.
I created a .bash_profile and added the following:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
export M2_HOME=/Users/aastha/apache-maven-3.3.9
export PATH=$PATH:$M2_HOME/bin
When I check echo $PATH, I get the following
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
(i.e) maven path is not imported.
and also mvn -version shows: mvn:command not found
When I manually source using source ~/.bash_profile and then do echo $PATH, I am able to see correct mvn path that I have entered in PATH variable in .bash_profile.
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/aastha/apache-maven-3.3.9/bin
mvn -version shows:
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T22:11:47+05:30)
Maven home: /Users/aastha/apache-maven-3.3.9
Java version: 1.8.0_101, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.11.5", arch: "x86_64", family: "mac"
My terminal does not source .bash_profile until I manually source it using
source ~/.bash_profile
Note: I created a .profile with the similar content and found out in this case mvn -version shows the maven is installed. And terminal is sourcing .profile automatically.
Why is my terminal not able to source .bash_profile automatically
Could somebody please help?
Thanks in advance :D
I have maven home directory as below,
[root#localhost configuration-simple]# su -c "vi /etc/profile.d/maven.sh"
[root#localhost configuration-simple]# mvn -version
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 19:21:28+0530)
Maven home: /home/kartyk/NetBeansProjects/motown.io/motown-develop/apache-maven-3.0.5
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /usr/java/jdk1.7.0_51/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.19.8-100.fc20.x86_64", arch: "amd64", family: "unix"
[root#localhost configuration-simple]#
Now I want to change the Maven home directory to some other folder, how could I do this through command prompt?
I assume you are familiar with basics of your OS.
go to Maven download page and get the latest version
extract it in a directory of your choice (/opt or /usr/local or ...)
set and export the environment variable MAVEN_HOME in your .bashrc
extend and export the environment variable PATH by $MAVEN_HOME/bin
I have installed Maven on Ubuntu 12.04. The following is the output when I do
$ mvn --version
Listening for transport dt_socket at address: 8787
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.6.0_38, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/jdk1.6.0_38/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-52-generic", arch: "amd64", family: "unix"
but when I do
$ gedit /etc/environment
the output is
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
also the .bash_rc does not have any entry for JAVA_HOME and there is no .bash_profile file.
My Question
If JAVA_HOME is not set how mvn --version is showing a value of it?
If JAVA_HOME is not set how mvn --version is showing a value of it?
On my system, the mvn program is a shell script, which performs various operations to try to guess a value for JAVA_HOME, if a value is not already set. In particular, it examines the location of the javac program.
However, according to the answer of a related question, what mvn reports as "Java home" is not the value of the JAVA_HOME environment variable: it is the value of the java.home system proeprty
Can be set in /etc/.bash_profile or other system rc files.
I have env.variable $JAVA_HOME it points to folder with jdk7
but if I execute "mvn -version" I see next
MacBook-Pro-Erik:~ erik$ mvn -version
728-version
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 06:15:32+0400)
Maven home: /Users/erik/distribs/maven/apache-maven-3.1.0
Java version: 1.6.0_51, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.8.4", arch: "x86_64", family: "mac"
How to enforce maven to use correct jdk? I have java.lang.UnsupportedClassVersionError becouse of this issue :(
Solved by:
echo JAVA_HOME=`/usr/libexec/java_home -v 1.7` | sudo tee -a /etc/mavenrc