Different ways of enabling debugging in java

There are different ways we can acquire database connections in java. This is a quick post which shows how to acquire connections.

Remote Debugging of Java Applications

Remote debugging uses the Java Platform Debugger Architecture (JPDA) in order to broker information from a running virtual machine (VM) and a debugging tool, usually an IDE capable of interacting with the Java Debug Wire Protocol (JDWP).

	-Xrunjdwp:transport=dt_socket,
	server=y,
	suspend=y,
	address=8000
	-Xnoagent -Djava.compiler=NONE"

Starting Gradle in debug mode

Gradle is a build system that uses Groovy to script the build that feels very intuitive for Java developers.

If you are running Linux, you can simply export GRADLE_OPTS, as shown in the following code:

	export GRADLE_OPTS="-Xdebug
		-Xrunjdwp:transport=dt_socket,
		server=y,
		suspend=y,
		address=8000
		-Xnoagent -Djava.compiler=NONE"

If you are running Windows, you can simply export GRADLE_OPTS, as shown here:

		set GRADLE_OPTS="-Xdebug
		-Xrunjdwp:transport=dt_socket,
		server=y,
		suspend=y,
		address=8000
		-Xnoagent -Djava.compiler=NONE"

Adding debug options to JAVA_OPTS

Besides running in a build system that is starting the Java processes for you, there are instances when you may want to add debugging options to all the running processes that might take advantage of remote debugging.

If you are running Linux, you can simply export GRADLE_OPTS, as shown here:

    export JAVA_OPTS="-Xdebug
            -Xrunjdwp:transport=dt_socket,
            server=y,
            suspend=y,
            address=4000
            -Xnoagent -Djava.compiler=NONE"

If you are running Windows, you can simply export JAVA_OPTS, as shown in the following code snippet:

    set JAVA_OPTS="-Xdebug
        -Xrunjdwp:transport=dt_socket,
        server=y,
        suspend=y,
        address=4000
        -Xnoagent -Djava.compiler=NONE"

Version History


Date Description
2013-11-11    Initial Version