0

I believe there is a command to check the number of java classes loaded on an instance.

I have tried with top -H, jstack.

But they dont print the number of classes loaded, is there a way to check this by a console command?

BugsOverflow
  • 386
  • 3
  • 19

1 Answers1

1

You’re thinking of the jstat command:

jstat -class vmid 
Tim Moore
  • 8,958
  • 2
  • 23
  • 34
  • I can execute command "jstat" alone, but if I add the -class vmid or any other, it doesnt let me, any idea? It says "invalid arguments. try `jstat -h to see usage" and when I execute jstat -h it only prints: usage: jstat [--count=] count : Amount of jstat lines to run – BugsOverflow Jul 30 '23 at 00:17
  • That sounds like a different `jstat` command – Tim Moore Jul 30 '23 at 00:25
  • What does `which jstat` print for you? – Tim Moore Jul 30 '23 at 00:26
  • It prints "which: command not found", maybe this is a different jstat that is on the container, is there another way? – BugsOverflow Jul 30 '23 at 02:15
  • You could pass the absolute path to the JDK `jstat` command if it’s installed on the container, or run `jstat` on a different machine and [connect remotely to the container running `jstatd`](https://stackoverflow.com/questions/44690253/unable-to-connect-to-a-remote-jvm-using-jstat), or connect remotely to `jstatd` using a different tool such as [VisualVM](https://docs.oracle.com/javase/8/docs/technotes/guides/visualvm/applications_remote.html). – Tim Moore Jul 30 '23 at 02:48
  • A common thing to do in environments that use containers is to run some kind of instrumentation agent with your application that exports metrics like this to a common monitoring service such as Prometheus – Tim Moore Jul 30 '23 at 03:01