Friday, March 24, 2017

Solving jps: command not found error message

jps is a command line utility that comes with jdk which allows you to view all the Java processes running on a host. It is extremely useful when your environment has multiple background java processes running, like it happens in a Hadoop cluster. If you happen to create a hadoop cluster by yourself as mentioned in my previous blogs, 'jps' command is very useful to diagnostic utility to make sure the NameNodes, DataNodes, ProcessManager and ResourceManager processes are running.

Sometimes if you try to use 'jps' and get the error message "jps: command not found error message" here is how you solve it


Step 1) Make sure you have installed a JDK, not a jre. In order to do that, you have to find out the directory where the jre is present. Mostly you can find it from the JAVA_HOME environment variable. A general rule of thumb is if the Java installation directory only has a 'jre' folder , then you might not have JDK installed.

Below is the output if you just have jre installed
$ cd $JAVA_HOME
$ cd ..
$ ls
jre  LICENSE  THIRD_PARTY_README

On a linux you can install JDK by appending '-devel' to the installation package
$ sudo yum install java-1.7.0-openjdk-devel

Run 'ls' command again, you should see the below output
$ cd $JAVA_HOME
$ cd ..
$ ls
bin  include  jre  lib  LICENSE  tapset  THIRD_PARTY_README


Step 2) Make sure the JDK_INSTALL_PATH/bin is in the classpath

Now if you try the 'jps' command, you should see the java processes running. On a Hadoop name node, you should see the below output

$jps
JPS
NameNode
TaskTracker
JobTracker

Blog Archive