JConsole location in Linux
Asked Answered
W

6

8

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?

Wilder answered 30/9, 2014 at 14:28 Comment(0)
F
11

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

Fabron answered 30/9, 2014 at 14:38 Comment(2)
I did not have SDK installed.Wilder
running Linux MINT 20.2 with openjdk version "11.0.14" 2022-01-18 - I've scoured the internet and can't seem to find the right way to install "Java SDK" to get jconsole myself. Any advice?Illume
H
6

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

reena@IM-1500:~$ jconsole

It will launch java monitoring console dialog.

Henning answered 30/9, 2014 at 14:36 Comment(2)
Thanks for your fast response. I tried that as well and I got this message -bash: jconsole: command not foundWilder
no it did not run. It give below error. -bash: jconsole: command not foundWivinia
X
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.

Xerox answered 30/9, 2014 at 14:44 Comment(0)
E
1

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

Expressman answered 30/9, 2014 at 14:41 Comment(0)
S
0

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.

Smythe answered 1/10, 2014 at 16:12 Comment(0)
P
0

Please install JDK Development Package to get Jconsole

Phile answered 13/7, 2020 at 13:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.