问题
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.
回答1:
You just have to put $JAVA_HOME/bin
in your $PATH
variable.
回答2:
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.
yum list java*devel*
sudo yum install java-1.7.0-openjdk-devel.x86_64
jps
回答3:
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
回答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
回答5:
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
回答6:
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
回答7:
This command also worked me:
alias jps='<your JDK path>/bin/jps'
回答8:
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.
回答9:
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.
来源:https://stackoverflow.com/questions/11286669/jps-not-working