Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java execution details in System.out

As I remember there is a magic command line option in Java that turns on writing of operations that are currently executed to the console. The output looks like byte code.

-verbose does not match as it prints only class loading, while this option outputs information like memory allocation, setting local variables etc. It was very detailed, like 10 lines for "Hello world".

I didn't find it here https://www.oracle.com/java/technologies/javase/vmoptions-jsp.html or here https://docs.oracle.com/javase/1.5.0/docs/tooldocs/solaris/java.html. Also I have found some flags, but most of them only work in openjdk or in the develop mode. Maybe there is a way I can start java.exe on Windows in this develop mode? Or maybe there is another set of flags that these lists miss?

like image 702
John Avatar asked May 31 '10 16:05

John


People also ask

How to execute a system command in Java?

Basically, to execute a system command, pass the command string to the exec () method of the Runtime class. The exec () method returns a Process object that abstracts a separate process executing the command. From the Process object we can get outputs from and send inputs to the command. The following code snippet explains the principle:

Which method is used to exit the system in Java?

The following example shows the usage of java.lang.System.exit () method. System.out.println ("exit..."); arr [0] = 1 arr [1] = 2 arr [2] = 3 arr [3] = 4 exit...

How to exit current program in Java?

The java.lang.System.exit() method exits current program by terminating running Java virtual machine. This method takes a status code. A non-zero value of status code is generally used to indicate abnormal termination. This is similar exit in C/C++.

What is the difference between system and out in Java?

System: It is a final class defined in the java.lang package. out: This is an instance of PrintStream type, which is a public and static member field of the System class. println (): As all instances of PrintStream class have a public method println (), hence we can invoke the same on out as well.


1 Answers

Not quite what you asked, but I'm a big fan of "kill -3" on the java process id - that dumps out all sorts of information about every thread and what state they are in, what locks they hold and what locks they are waiting on, and that sort of thing.

like image 185
Paul Tomblin Avatar answered Sep 23 '22 04:09

Paul Tomblin