使用cd ~ 命令返回到 ~使用vi ./.bash_peofile打开文件,更改PATH的路径,使用jdk的绝对路径,如下所示:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:/opt/java/jdk1.8.0_261/bin
#使用jdkbin目录的绝对路径
export PATH
使变量生效:source ./.bash_profile
保存之后再次使用jps就可以使用了。
如下图:
324 NameNode
728 SecondaryNameNode
970 ResourceManager
3548 Jps