30

I have installed java-1.6.0-openjdk-devel.

$java -version

java version "1.6.0_24"

OpenJDK Runtime Environment (IcedTea6 1.11.3) (rhel-1.48.1.11.3.el6_2-x86_64)

OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

when typing jps into command prompt

$jps

-bash: jps: command not found

I do not believe it is an openjdk error because I have used it around 6 months back on the same system and it worked fine. Also, it works fine on my laptop.

Pshemo
  • 122,468
  • 25
  • 185
  • 269
Phelodas
  • 3,853
  • 5
  • 25
  • 30

12 Answers12

33

You just have to put $JAVA_HOME/bin in your $PATH variable.

Spudley
  • 166,037
  • 39
  • 233
  • 307
Anupam Bagchi
  • 370
  • 4
  • 3
20

That is common issue. The reason of this problem is that open jdk package just contains jre in CentOs. Therefore, jps ise not preinstalled. In order to solve this problem and develop java applications, open jdk devel packages must be installed.

Firstly, list developer packages and install suitable one with the commands shown belows. Pick the most relevant version from the list in 1 to use with 2.

  1. yum list java*devel*
  2. sudo yum install java-<version>-openjdk-devel.x86_64
tink
  • 14,342
  • 4
  • 46
  • 50
tolgabuyuktanir
  • 646
  • 6
  • 20
10

jps is not part of the openjdk. you have to install it by using the command

for java 7 - sudo yum install java-1.7.0-openjdk-devel

for java 8 - sudo yum install java-1.8.0-openjdk-devel

Keerthikanth Chowdary
  • 728
  • 1
  • 10
  • 17
8

Add JAVA_HOME to PATH variable in bashrc file if you are using linux based OS.

vim ~/.bashrc
export JAVA_HOME=/opt/jdk1.8.0_72/
export PATH=$JAVA_HOME/bin:$PATH
source ~/.bashrc
Ajeet Shah
  • 18,551
  • 8
  • 57
  • 87
Hemanth H L
  • 111
  • 1
  • 6
4

check the installation directory of java i.e $JAVA_HOME

then make a sym link i.e

ln -s $JAVA_HOME/bin/jps /usr/bin/jps

Vikash Singh
  • 884
  • 8
  • 11
4

When I try jps I got

jps: command not found...

Because I did not install jps

and I solved by installing jdk.

yum install jdk
Sachith Muhandiram
  • 2,819
  • 10
  • 45
  • 94
ppromsiri
  • 61
  • 2
2

This command also worked me:

alias jps='<your JDK path>/bin/jps'
Celtik
  • 327
  • 4
  • 14
2

This command worked for me...! sudo apt install openjdk-8-jdk-headless

1

firstly, please make sure jps is installed somewhere. it should be run command sudo update-alternatives --config jps --auto to link the jps to /usr/bin/jps Or just appending $JAVA_HOME/bin to your $PATH like the first answer.

shawnzhu
  • 7,233
  • 4
  • 35
  • 51
0

try this command: export PATH=$PATH:/home/dav/jdk1.7.0_45/bin

its relative path of your java. In this case my java is situated inside /home/dav/ dir. then run jps it will work.

DK Rajput
  • 1
  • 1
0

Just to add a little more details to this: "You just have to put $JAVA_HOME/bin in your $PATH variable." @Spudley's answer.

Note that the way to add that is to use %JAVA_HOME%\bin to $PATH.

Muhammad Tariq
  • 3,318
  • 5
  • 38
  • 42
Roy V
  • 11
  • 2
-1

After a two hours. In my case I used this comand in Rhel 7.X

sudo yum install java-1.8.0-openjdk -y

But jps not installed, It's not appear in /usr/bin/jps, then installed this package and works jps command.

sudo yum -y install java-1.8.0-openjdk-devel
Hernaldo Gonzalez
  • 1,977
  • 1
  • 21
  • 32