Friday 26 July 2013

Debug Java applications remotely with Eclipse

The screens in eclipse
You don't need to debug Java™ applications on just your local desktop.
Remote debugging can be useful for application development, such as developing a program for a low-end machine that cannot host the development platform, or debugging programs on dedicated machines like Web servers, whose services cannot be shut down. Other examples include Java applications running with limited memory or CPU power, such as mobile devices, or developers wanting to separate the application and development environments, etc.

Full article: http://www.ibm.com/developerworks/opensource/library/os-eclipse-javadebug/index.html 

If you don't have it already, download Eclipse V3.4 (Ganymede). In Ganymede, the socket listening connector has been added to the Remote Java Application launch-configuration type. Eclipse's new socket listening connector allows you to start the Java debugger, which listens for a connection on a specific socket. The program being debugged can then be started with command-line options to connect to the debugger. Prior to the Ganymede release, only a socket-attaching connector was provided, and the program being debugged had to be a debug host that was connected by the debugger. It is impractical for mobile devices to be a host due to insufficient memory and CPU power.

The Java Debug Wire Protocol (JDWP) contains many arguments that have been added to invoke the application for the remote Java application. Following are some of the arguments used in this article.
-Xdebug
Enables debugging features.
-Xrunjdwp:<sub-options>
Loads the implementation of JDWP in the target VM. It uses a transport and the JDWP protocol to communicate with a separate debugger application. Specific suboptions are described below.
Starting from Java V5, you can use the -agentlib:jdwp option, instead of -Xdebug and -Xrunjdwp. But if you have to connect to the VM prior to V5, -Xdebug and -Xrunjdwp will be the only choice. Following are brief descriptions of the -Xrunjdwp suboptions.
transport
Generally, socket transport is used. But shared-memory transport can also be used on the Windows platform, if available.
server
If the value is y, the target application listens for a debugger application to attach. Otherwise, it attaches to a debugger application at the specified address.
address
This is the transport address for the connection. If the server is n, attempt to attach to a debugger application at this address. Otherwise, listen for a connection at this port.
suspend
If the value is y, the target VM will be suspended until the debugger application connects. 
This is ideal for setting up remote debugging for eclipse.
The typical settings would be "-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n".

This article lists some nice options for remote debugging a Liferay portal.
http://holisticsecurity.wordpress.com/tag/eclipse/
Enjoy. 

PS.

Friday 5 July 2013

Cool tool of the day: vLetter

Vletter is a nice way to create handwritten text quickly.

As they say on their site:

We create your own handwriting fontto use on your computer. vLetter captures the natural variations in your handwriting to give your letters, cards and other correspondence a unique, personal touch. Your handwriting font also includes your signature, so you can sign documents and letters with ease. We've been creating personal handwriting fonts since 1988!
Any way its kinda fun ...

Cheers