Breaking News
Home / Java / Java Snippets / How to enable tracing in Java 2D?

How to enable tracing in Java 2D?

Enable Tracing in Java 2DIn order to understand low-level workings or debug method calls of Java 2D , trace can be turned a cmd line option as show below:

java -Dsun.java2d.trace=log,count,out:trace.log <class name>

This option will instruct the JVM to record all the internal calls made by Java 2D, together with a count of the calls, to the text file called as trace.log.

Normally it would create a huge file and might be difficult to analyze the output.
So if method calls are not required and only the call counts are to recorded, then the output trace data will be more manageable as show below:

java -Dsun.java2d.trace=count,out:trace.log <class name>


Check Also

How to progamatically get the Java version?

Snippet The key here is to use the system property java.version and get minor and …

Leave a Reply