Hadoop:JPS 找不到已安装的 Java

发布于 2024-12-10 19:56:42 字数 895 浏览 0 评论 0原文

我的配置是

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

我已经安装了java,

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

并且也在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

如何使JPS工作?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(12

给我一枪 2024-12-17 19:56:42

Saurabh Saxena 的上述答案不再正确。
要获得jps,您还需要安装开发工具java-1.6.0-openjdk-devel。
在 CentOS 6 上,该文件是:
java-1.6.0-openjdk-devel.x86_64

所以:

yum install java-1.6.0-openjdk*

就可以了(除了 jdk 和开发工具之外,还可以获取演示和 javadocs,但您将获得命令行工具的完整补充)。

对于 Ubuntu:

apt-get install java-1.6.0-openjdk-devel 

对于所有这些示例,您可以尝试 JDK7(只需替换 1.7),并且截至 2012 年 12 月,Hadoop 在没有 Oracle 库的情况下相当稳定。请参阅:http://openjdk.java.net/install/

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/

烂人 2024-12-17 19:56:42

这或许也是一个原因。很简单:看看 $javac 是否有效。注意:$java 可能有效,请检查 javac。如果 $javac 不起作用,那么 $jps 也将不起作用。
所以你可能想做类似的事情

导出 PATH=$PATH:$JAVA_HOME/bin

并重试。 javac 和 jps 都可以。
祝你好运。

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.

玩世 2024-12-17 19:56:42

我已经找到了缺少 JPS 命令的解决方案。我在 ubuntu 机器上以伪分布式模式安装 Hadoop 1.x。我使用Java-7-openJDK来提供Java命令和工具。由于某种原因,版本 6 有一个 java-1.6.0-openjdk-devel,但版本 7 没有,特别是 debian 和 ubuntu 发行版。我不确定 Fedora 和 Redhat 是否也是如此。所以当时最好的答案是使用 linux 命令

ps -aux | grep java

我讨厌这样做,因为 Hadoop 守护进程启动时有太多选项,以至于每个结果都填满了一个屏幕。除了看到 java 正在运行之外,不可能看到 hadoop 守护进程正在运行。因此,我想出了一行 shell 脚本形式的简短灵魂

这是我的开放 JDK 的 JPS 脚本

!#/bin/bash

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

END

我将这两行保存在名为 jps 的文件中,并将其存储在具有执行权限的 hadoop/bin 目录中

**这是脚本的结果
hduser@localhsot# ./jps

-Dproc-namenode

-Dproc-datanode

-Dproc-JobTracker

-Dproc-TaskTracker**

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**

岁月无声 2024-12-17 19:56:42

open-jdk里好像没有jps。
对于hadoop来说,安装sun-jvm会是更好的选择。

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

挽容 2024-12-17 19:56:42

试试这个....

sudo apt-get install openjdk-7-jdk

try this....

sudo apt-get install openjdk-7-jdk
深白境迁sunset 2024-12-17 19:56:42

我想为那些面临同样问题的人更新主题。

JDK8 也没有“jps”命令,但 JDK7 有。

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

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
一城柳絮吹成雪 2024-12-17 19:56:42

使用 sudo apt-get install openjdk-7-jdk 而不是 openjdk-7-jre。 。

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

亽野灬性zι浪 2024-12-17 19:56:42

对于 ubuntu 中的 java 8,请使用以下命令。
sudo apt install openjdk-8-jdk-headless

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

半边脸i 2024-12-17 19:56:42

对于 Hadoop,Oracle JDK 6 首选,我我不确定是否有人在没有任何补丁的情况下成功地将 OpenJDK 与 Hadoop 结合使用。仅供参考,有一些关于 也支持 JDK 7。目前,有太多对 Oracle JDK 的依赖。希望依赖性很快消失。

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.

离不开的别离 2024-12-17 19:56:42

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

当时就找到了

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

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
不弃不离 2024-12-17 19:56:42

打开 syneptics 包管理器并安装 openjdk-7-jdkopenjdk-6-jdk 包。之后 jps 就可以工作了

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

£冰雨忧蓝° 2024-12-17 19:56:42

安装sudo apt-get install openjdk-8-jdk-headless而不是jre

Install sudo apt-get install openjdk-8-jdk-headless not jre

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文