I am new to Mac OSX and I'm running Yosemite. I am trying to set up Maven using this official guide in order to set up a Google Cloud Messaging Backend. Here's what I did:
1) Downloaded Maven zip (version: apache-maven-3.3.9) and Unzipped it
2) As the guide says, I need to add the bin directory to my PATH variable. So I did the following in my terminal
export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.9
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60
export PATH=$JAVA_HOME/bin:$M2_HOME/bin:$PATH
The terminal didn't return any response. However when I checked to see if Maven got installed using:
mvn -version
I get a message saying:
-bash: mvn: command not found
What am I doing wrong? Did I follow the steps properly to set up Maven?
EDIT:
MVN Bin Directory path is:
/Users/Earthling/Documents/Projects/MobiProject/apache-maven-3.3.9
I tried all the manual steps here and still couldn't get it to work. Then I realized I can easily install it using Homebrew, much more convenient:
brew install maven
that's all you need to install maven for mac!
The $PATH is what point where your programs are, because of that you change it in order to find mvn. Actually you are pointing $PATH to $M2_HOME/bin.
You need to update $M2_HOME to one directory level before mvn bin and before update $PATH.
If this is your mvn home:
/Users/Earthling/Documents/Projects/MobiProject/apache-maven-3.3.9
you should use this env vars:
export M2_HOME="/Users/Earthling/Documents/Projects/MobiProject/apache-maven-3.3.9"
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_60"
export PATH="$JAVA_HOME/bin:$M2_HOME/bin:$PATH"
You can also edit your ~/.profile in order to include these lines, so you don't need to type these exports whenever you open your terminal.
Do
export M2_HOME=/Users/Earthling/Documents/Projects/MobiProject/apache-maven-3.3.9
Related
I am trying to install Spring Boot CLI in Ubuntu. I am new to spring boot and was trying to learn it. I have already installed Gradle and groovy but did not find anything online to install Spring boot CLI.
please follow the code
sudo apt install unzip zip
curl -s https://get.sdkman.io | bash
source "/home/username/.sdkman/bin/sdkman-init.sh"=
sdk install springboot
spring version
The Spring boot CLI install guide link
Spring boot CLI
You can read the docs for installation steps:
Manual installation:
Download the Spring CLI distribution: you can find the latest version link here.
Extract the downloaded zip file to any path of your choice.
Prerequisite: Make sure you have Java JDK v1.8 or above (check INSTALL.txt file from extracted archive in Step-1). You can check your JDK version using command: java --version.
Add the spring CLI script's path to $PATH environment variable:
For example, you can add below lines to your .bashrc file in *nix systems:
export SPRING_HOME=/path/to/your/extracted-spring-cli/spring-2.4.0
export PATH=$SPRING_HOME/bin:$PATH
After saving the .bashrc file, run $ source .bashrc to reload the environment variables you just added.
(optional; and not for Windows user) Shell auto-completion scripts are provided for BASH and ZSH with the extracted archive in Step-1. Add symlinks to the appropriate
location for your environment. For example, something like:
ln -s /path/to/your/extracted-spring-cli/spring-2.4.0/shell-completion/bash/spring /etc/bash_completion.d/spring
ln -s /path/to/your/extracted-spring-cli/spring-2.4.0/shell-completion/zsh/_spring /usr/local/share/zsh/site-functions/_spring
To check if you are using BASH or ZSH, run the command: $ echo $SHELL.
DONE: To test if you have successfully installed the CLI you can run the following command: spring --version.
Here is detailed instruction on how to do it, much more useful than official one, at least for manual installation. One more thing - to make path change permanent you might need to logout - login, as "source /etc/profile" will be effective only for currently opened terminal.
Use this link to get a detailed instruction on how to download the Spring framework successfully, It really helped me a lot after long time of making research.
https://www.decodejava.com/download-and-install-spring-framework.htm
Actually I tried to install Apache Maven to my system.
I followed these steps:
Downloaded apache-maven-3.3.3 in my Window 8 machine and copied to Program Files.
Then added maven path C:\Program Files\apache-maven-3.3.3 as M2_HOME in system variable and added C:\Program Files\Java\jdk1.8.0_31 as JAVA_HOME.
Then added ;%M2_HOME%\bin to default Path.
Then tried to run as mvn -version in CMD.
But I got the result like:
mvn is not recognized as an internal or external command...
I remember I had similar issue some time ago on Windows 7. On Windows 8 it may behave similarly. Your solution should work correctly, but for some reason it's not working.
Add path to bin/ directory inside your Maven directory to the Path system variable after semicolon. In your case it will be:
C:\Program Files\apache-maven-3.3.3\bin
Save Path variable, close terminal, run it again and type: mvn -version.
I have a java program in which a use the GLPK Solver. The error that i receive when i run it on eclipse is the following:
The dynamic link library for GLPK for Java could not beloaded.
Consider using
java -Djava.library.path=
The current value of system property java.library.path is:
/Users/maria/Documents/solver_library/GLPK/w64
I had the same problem on my old windows computer and i solved it doing the following:
1. Adding in the Java Build Path->Libraries the glpk-java.jar file
2.Adding as the Native library location of the above jar the corresponding path (C:\ProgramFiles\solver_library\GLPK\w64
3. adding in the PATH environment variable the above path.
I am doing exactly the same things on my new MAC OS X computer but still receiving the above error. I did with exactly the same way the steps 1 and 2 above and also I modified through the terminal the PATH system variable. This now is:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/maria/Documents/solver_library/GLPK/w64
Could you please tell me if you have any idea of how to solve this? I am a new Mac user so i don't know many things.
Thanks in advance!
Here's what I did to make it work on OS X.
Install glpk.
I used for this homebrew
$ brew install glpk
$ brew install swig // this package we well need for glpk for java
Install glpk for java http://sourceforge.net/projects/glpk-java/files/glpk-java/
Unzip the archive with:
$tar -xzf glpk-java-1.0.37.tar.gz
$cd glpk-java-1.0.37
Configure with:
$./configure \
CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers \
SWIGFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
Make and install with:
$make
$make check
$make install
Now in swig dir you should have 3 jars:
glpk-java.jar, glpk-java-sources.jar, glpk-java-javadoc.jar and the .lib folder (hidden).
For compiling you need to put glpk-java.jar in your classpath and specify javac option -Djava.library.path=/YOUR_PATH/libglpk-java-1.0.37/swig/.libs
I followed "http://codesfusion.blogspot.com/2013/10/setup-hadoop-2x-220-on-ubuntu.html" to install hadoop on ubuntu. But, upon checking the hadoop version I get the following error:
Error: Could not find or load main class
org.apache.hadoop.util.VersionInfo
Also, when I try: hdfs namenode -format
I get the following error:
Error: Could not find or load main class
org.apache.hadoop.hdfs.server.namenode.NameNode
The java version used is:
java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
It is a problem of environmental variables setup. Apparently, I didnt find one which can work until NOW. I was trying on 2.6.4. Here is what we should do
export HADOOP_HOME=/home/centos/HADOOP/hadoop-2.6.4
export HADOOP_INSTALL=$HADOOP_HOME
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin
export HADOOP_CONF_DIR=$HADOOP_HOME
export HADOOP_PREFIX=$HADOOP_HOME
export HADOOP_LIBEXEC_DIR=$HADOOP_HOME/libexec
export JAVA_LIBRARY_PATH=$HADOOP_HOME/lib/native:$JAVA_LIBRARY_PATH
export HADOOP_CONF_DIR=$HADOOP_PREFIX/etc/hadoop
Add these into your .bashrc and dont forget to do
source ~/.bashrc
I think your problem will be solved as was mine.
You probably did not follow the instructions correctly. Here are some things to try and help us / you diagnose this:
In the shell that you ran hadoop version, run export and show us the list of relevant environment variables.
Show us what you put in the /usr/local/hadoop/etc/hadoop/hadoop-env.sh file.
If neither of the above gives you / us any clues, then find and use a text editor to (temporarily) modify the hadoop wrapper shell script. Add the line "set -xv" somewhere near the beginning. Then run hadoop version, and show us what it produces.
Adding this line to ~/.bash_profile worked for me.
export HADOOP_PREFIX=/<where ever you install hadoop>/hadoop
So just:
$ sudo open ~/.bash_profile then add the aforesaid line
$ source ~/.bash_profile
Hope this helps (:
I was facing the same issue. Although it may seem so simple but took away 2 hrs of my time. I tried all the things above but it didn't help.
I just exit the shell i was in and tried again by logging into the system again. Then things worked!
Try to check:
JAVA_HOME, all PATH related variables in Hadoop config
run: . ~/.bashrc (note the dot in front) to make those variables available in your environment. It seems that the guide does not mention this.
I got the same problem with hadoop 2.7.2
after I applied the trick shown I was able to start hdfs but later I discovered that the tar archivie I was using was missing some important pieces. So downloading the 2.7.3 everything worked as it is supposed to work.
My first suggestion is to download again the tar.gz at the same version or major.
If you are continuing to reading... this how I solved the problem...
After a fresh install hadoop was not able to find the jars.
I did this small trick:
I located where the jars are
I did a symbolic link of the folder to
$HADOOP_HOME/share/hadoop/common
ln -s $HADOOP_HOME/share/hadoop/kms/tomcat/webapps/kms/WEB-INF/lib $HADOOP_HOME/share/hadoop/common
for version command you need hadoop-common-2.7.2.jar, this helped me to find where the jars where stored.
After that...
$ bin/hadoop version
Hadoop 2.7.2
Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r b165c4fe8a74265c792ce23f546c64604acf0e41
Compiled by jenkins on 2016-01-26T00:08Z
Compiled with protoc 2.5.0
From source with checksum d0fda26633fa762bff87ec759ebe689c
This command was run using /opt/hadoop-2.7.2/share/hadoop/kms/tomcat/webapps/kms/WEB-INF/lib/hadoop-common-2.7.2.jar
Of course any hadoop / hdfs command works now.
I'm again an happy man, I know this is not a polite solution but works at least for me.
I got that error , I fixed that by editing ~/.bashrc
as follow
export HADOOP_HOME=/usr/local/hadoop
export PATH=$HADOOP_HOME/bin:$PATH
then open terminal and write this command
source ~/.bashrc
then check
hadoop version
Here is how it works for Windows 10 Git Bash (mingw64):
export HADOOP_HOME="/PATH-TO/hadoop-3.3.0"
export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin
export HADOOP_CLASSPATH=$(cygpath -pw $(hadoop classpath)):$HADOOP_CLASSPATH
hadoop version
copied slf4j-api-1.6.1.jar into hadoop-3.3.0\share\hadoop\common
I added the environment variables described above but still didn't work. Setting the HADOOP_CLASSPATH as follows in my ~/.bashrc worked for me:
export HADOOP_CLASSPATH=$(hadoop classpath):$HADOOP_CLASSPATH
I used
export PATH=$HADOOP_HOME/bin:$PATH
Instead of
export PATH=$PATH:$HADOOP_HOME/bin
Then it worked for me!
I'm trying to run a .jar file on my centos box, but it says "java: command not found".
What's the best or easiest way to solve this? I was hoping for a yum command but not sure that that will exist for java?
Apparently some versions of CentOS doesn't come with a JVM installed due to some licensing restriction. See HowTo Install Java on CentOS 4 and CentOS 5 for instructions.
You can use such command to check if Java is available in your repository:
yum list | grep java
It should return something like that:
java-1.6.0-openjdk
java-1.6.0-sun
If such package exists you can install it using such command (run it as the root user):
yum install java-1.6.0-openjdk
Either the JRE is not installed or, more likely, its location is not included in your PATH environment variable. If the java executable is not in your PATH, you would need to use the full path & filename to execute it.
cd to the location of the jar file
C:\temp>java -jar sample.jar