Linux jps不工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11286669/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 07:11:44  来源:igfitidea点击:

jps not working

javalinuxredhatopenjdk

提问by Phelodas

I have installed java-1.6.0-openjdk-devel.

我已经安装了 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 时

$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.

我不相信这是一个 openjdk 错误,因为我在同一个系统上使用了大约 6 个月,并且运行良好。此外,它在我的笔记本电脑上运行良好。

采纳答案by Anupam Bagchi

You just have to put $JAVA_HOME/binin your $PATHvariable.

你只需要$JAVA_HOME/bin输入你的$PATH变量。

回答by shawmzhu

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

首先,请确保在某处安装了 jps。应该运行命令sudo update-alternatives --config jps --auto将 jps 链接到/usr/bin/jps或者只是附加$JAVA_HOME/bin到你$PATH喜欢的第一个答案。

回答by DK Rajput

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

试试这个命令: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.

它的相对路径你的java。在这种情况下,我的 java 位于 /home/dav/ 目录中。然后运行 ​​jps 它会工作。

回答by Vikash Singh

check the installation directory of java i.e $JAVA_HOME

查看java的安装目录即$JAVA_HOME

then make a sym link i.e

然后做一个符号链接,即

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

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

回答by Hemanth H L

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

如果您使用的是基于 linux 的操作系统,请将JAVA_HOME 添加到bashrc文件中的PATH 变量。

vim ~/.bashrc
export JAVA_HOME=/opt/jdk1.8.0_72/
export PATH=$JAVA_HOME/bin:$PATH
source ~/.bashrc

回答by Celtik

This command also worked me:

这个命令也对我有用:

alias jps='<your JDK path>/bin/jps'

回答by ppromsiri

When I try jps I got

当我尝试 jps 时,我得到了

jps: command not found...

jps:找不到命令...

Because I did not install jps

因为我没有安装jps

and I solved by installing jdk.

我通过安装jdk解决了。

yum install jdk

回答by tolgabuyuktanir

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.

那是常见的问题。出现这个问题的原因是CentOs中打开的jdk包只包含jre。因此,未预装 jps ise。为了解决这个问题,开发java应用,必须安装open jdk devel包。

Firstly, list developer packages and install suitable one with the commands shown belows.

首先,列出开发包并使用如下所示的命令安装合适的包。

  1. yum list java*devel*
  2. sudo yum install java-1.7.0-openjdk-devel.x86_64
  3. jps
  1. yum list java*devel*
  2. sudo yum install java-1.7.0-openjdk-devel.x86_64
  3. jps

回答by Keerthikanth Chowdary

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

jps 不是 openjdk 的一部分。你必须使用命令安装它

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

对于 Java 7 - sudo yum install java-1.7.0-openjdk-devel

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

对于 Java 8 - sudo yum install java-1.8.0-openjdk-devel

回答by seema kanaje

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

这个命令对我有用...!sudo apt 安装 openjdk-8-jdk-headless