简体   繁体   中英

Hadoop : JPS can not find Java installed

my configurations are

hduser@worker1:/usr/local/hadoop/conf$ jps
The program 'jps' can be found in the following packages:
 * openjdk-6-jdk
 * openjdk-7-jdk
Ask your administrator to install one of them

I have java installed though

hduser@worker1:/usr/local/hadoop/conf$ java -version
java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre10-0ubuntu5)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

hduser@worker1:/usr/local/hadoop/conf$ echo $JAVA_HOME 
/usr/lib/jvm/java-1.6.0-openjdk

and also set up in conf/hadoop-env.sh

hduser@worker1:/usr/local/hadoop/conf$ cat hadoop-env.sh | grep JAVA_HOME
# The only required environment variable is JAVA_HOME.  All others are
# set JAVA_HOME in this file, so that it is correctly defined on
 export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk

How can I make JPS work?

Saurabh Saxena's answer above is no longer correct. To get jps, you want to also install the development tools java-1.6.0-openjdk-devel. On CentOS 6 the file is: java-1.6.0-openjdk-devel.x86_64

So:

yum install java-1.6.0-openjdk*

will do the trick (also picks up demo and javadocs besides the jdk and dev tools, but you will get the full complement of command line tools).

For Ubuntu:

apt-get install java-1.6.0-openjdk-devel 

For all these examples, you can try JDK7 (just substitute 1.7), and as of December 2012, Hadoop is pretty stable without the Oracle libraries. See: http://openjdk.java.net/install/

This might also be a reason. Its simple: See if $javac works. Note: $java might work, check javac. If $javac is not working then $jps will not work either. So you might want to do something like

export PATH=$PATH:$JAVA_HOME/bin

and try again. both javac and jps. good luck.

I have found the solution for the missing JPS command. I was installing Hadoop 1.x on ubuntu machine in a pseudo distributed mode. I used Java-7-openJDK to provide for the Java commands and tools. For some reason there was a java-1.6.0-openjdk-devel for version 6 but none for version 7 specifically debian and ubuntu distributions. I am not sure if the same is true for Fedora and Redhat. So the best answer as that time was using the linux command

ps -aux | grep java

I hated doing that because Hadoop daemons start with so many options that each result fills up more than a screen. Apart from seeing that java is running it is impossible to see what hadoop daemons are running. Hence i came up with a short soultion in the form of one line shell script

This is my JPS scirpt for open JDK

!#/bin/bash

ps -aux | grep java | awk '{print $12}'

END

I saved these two lines in a file named jps and stored it in the hadoop/bin directory with execute permissions

**Here is the result of the script hduser@localhsot# ./jps

-Dproc-namenode

-Dproc-datanode

-Dproc-JobTracker

-Dproc-TaskTracker**

It seems like open-jdk does not have jps in it. For hadoop, installing sun-jvm would be a better choice.

尝试这个....

sudo apt-get install openjdk-7-jdk

I would like to update topic for those who would face the same problem.

JDK8 also does not have the "jps" command but JDK7 does have it.

root@tahirpc:/home/tahir# java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.3) (**7u71-2.5.3-0ubuntu0.14.04.1**)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

root@tahirpc:~# jps
5036 NodeManager
4368 NameNode
4912 ResourceManager
5315 Jps
4773 SecondaryNameNode
4487 DataNode

Use sudo apt-get install openjdk-7-jdk and not openjdk-7-jre. .

For java 8 in ubuntu use the following command. sudo apt install openjdk-8-jdk-headless

I found it

rpm -qlp java-1.6.0-openjdk-devel-1.6.0.0-1.39.1.9.7.el6.x86_64.rpm | grep jps
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/bin/jps

then

rpm -i java-1.6.0-openjdk-devel-1.6.0.0-1.39.1.9.7.el6.x86_64.rpm

Open syneptics package manager and install openjdk-7-jdk and openjdk-6-jdk package. AFter that jps will work

For Hadoop, Oracle JDK 6 preferred , I am not sure if someone has used OpenJDK with Hadoop successfully without any patches. FYI, there had been some talks about support for JDK 7 also. For now, there is too much dependency on Oracle JDK. Hope the dependency goes away soon.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM