JConsole location in Linux

杀马特。学长 韩版系。学妹 提交于 2020-01-12 08:23:50

问题


I am trying to run jconsole from my machine but I can't find the location of the .sh . I have tried finding it in different directories and setting JAVA_HOME to the jdk.

$which java
/usr/bin/java
$java -version
java version "1.7.0_51"
OpenJDK Runtime Environment (rhel-2.4.4.1.el6_5-x86_64 u51-b02)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode) 
$whereis java 
java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java /usr/share/man/man1/java.1.gz

I looked in /usr/lib/jvm and I found

drwxr-xr-x. 3 root root 4096 Apr 23  2013 java-1.5.0-gcj-1.5.0.0
drwxr-xr-x. 3 root root 4096 Jan 27  2014 java-1.6.0-openjdk-1.6.0.0.x86_64
drwxr-xr-x. 3 root root 4096 Feb  5  2014 java-1.7.0-openjdk-1.7.0.51.x86_64
lrwxrwxrwx. 1 root root   21 Feb  5  2014 jre -> /etc/alternatives/jre
lrwxrwxrwx. 1 root root   27 Apr 23  2013 jre-1.5.0 -> /etc/alternatives/jre_1.5.0
lrwxrwxrwx. 1 root root   26 Apr 23  2013 jre-1.5.0-gcj -> java-1.5.0-gcj-1.5.0.0/jre
lrwxrwxrwx. 1 root root   27 Feb  5  2014 jre-1.6.0 -> /etc/alternatives/jre_1.6.0
lrwxrwxrwx. 1 root root   37 Feb  5  2014 jre-1.6.0-openjdk.x86_64 -> java-1.6.0-openjdk-    1.6.0.0.x86_64/jre
lrwxrwxrwx. 1 root root   27 Feb  5  2014 jre-1.7.0 -> /etc/alternatives/jre_1.7.0
lrwxrwxrwx. 1 root root   38 Feb  5  2014 jre-1.7.0-openjdk.x86_64 -> java-1.7.0-openjdk-1.7.0.51.x86_64/jre
lrwxrwxrwx. 1 root root   25 Apr 23  2013 jre-gcj -> /etc/alternatives/jre_gcj
lrwxrwxrwx. 1 root root   29 Feb  5  2014 jre-openjdk -> /etc/alternatives/jre_openjdk

and in java-1.7.0-openjdk-1.7.0.51.x86_64/jre/bin/, I only found

[root@portal01 bin]# ll
total 200
-rwxr-xr-x. 1 root root  9536 Jan 14  2014 java
-rwxr-xr-x. 1 root root  9656 Jan 14  2014 keytool
-rwxr-xr-x. 1 root root  9856 Jan 14  2014 orbd
-rwxr-xr-x. 1 root root  9688 Jan 14  2014 pack200
-rwxr-xr-x. 1 root root 10984 Jan 14  2014 policytool
-rwxr-xr-x. 1 root root  9648 Jan 14  2014 rmid
-rwxr-xr-x. 1 root root  9656 Jan 14  2014 rmiregistry
-rwxr-xr-x. 1 root root  9688 Jan 14  2014 servertool
-rwxr-xr-x. 1 root root  9896 Jan 14  2014 tnameserv
-rwxr-xr-x. 1 root root 92264 Jan 14  2014 unpack200

..even though there are 200 files. How can I find and run jconsole?


回答1:


jconsole is part of the Java SDK, it appears you only have the JRE installed.




回答2:


You can run jconsole directly from your terminal by running the command jconsole.

reena@IM-1500:~$ jconsole

It will launch java monitoring console dialog.




回答3:


From https://serverfault.com/questions/179908/fedora-jconsole-location:

Try running: yum provides */jconsole

that will tell you what package you need as well as where it's located in the package.




回答4:


Once you set the path of JDK in Linux then this command execute easily might be you had not included the JAVA_HOME with PATH variable.

plz follow this discussion




回答5:


If you have Java JDK installed in your Linux machine, usually jconsole is located at /usr/bin/ as a symbolic link.

Example from my Linux VM running Centos6

$ which jconsole
/usr/bin/jconsole
$ ls -l /usr/bin/jconsole
lrwxrwxrwx. 1 root root 26 Sep  4 10:05 /usr/bin/jconsole -> /etc/alternatives/jconsole
$ ls -l /etc/alternatives/jconsole
lrwxrwxrwx. 1 root root 51 Sep  4 10:05 /etc/alternatives/jconsole -> /usr/lib/jvm/java-1.7.0-openjdk.x86_64/bin/jconsole

But you mentioned you got the a command not found error when you typed jconsole at the prompt. Can you find if jconsole is available in one of the jdk's bin directory?

$ ls -l /usr/lib/jvm/java-1.7.0-openjdk.x86_64/bin | grep jconsole

If yes, then add this in your PATH environment variable like so

$ export PATH=$PATH:/usr/lib/jvm/java-1.7.0-openjdk.x86_64/bin

or put this in your ~/.bashrc if you are using Bash.

If jconsole is not there, then maybe you need to try another jdk which you have installed or re-install the jdk.



来源:https://stackoverflow.com/questions/26123324/jconsole-location-in-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!