Saturday, July 31, 2010

Command Prompt option on Right Click Menu

How to add command prompt option to right click ?

Most of us often need to open the command prompt which opens at User's Home directory and we had to change the path manually every time we open the command prompt. 

For making this much easier, I am providing here a simple way which you will be glad to use instead of irritating/time consuming way.

With below steps, you can open the command prompt and find yourself at the location you want to reach with just a single click of mouse.

[1] Create a new file and save it with any name but with the extension ".reg" i.e. registry file extension.

filename ezample:= abc.reg

[2] Now copy paste below code inside that file and again save it.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\Command]
@="Command Prompt"

[HKEY_CLASSES_ROOT\Directory\shell\Command\Command]

@="cmd.exe /k cd %1"

[3] Execute this file by simply double-clicking over it.

[4] Command Prompt option is added whenever you do a right-click on a folder.

This is one time procedure.

[5] Now onwards whenever you want to open the command prompt and reach out to a particular location, you can just browse through windows file explorer and right click on that particular folder and select command prompt option. 


Friday, July 30, 2010

Eclipse - Debug Web Application running on Tomcat/JBoss

How to debug a web application, running on Tomcat/JBoss server, in Eclipse ?

Here are the simple steps to follow:

Tomcat

[1] create new batch file along side "catalina.bat" file, paste following code, save and run:

set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket
catalina.bat jpda start

[2] Start eclipse -> Run menu -> debug configuration -> Remote Java Application -> New launch configuration -> Make sure port is 8000 in connection properties.



JBoss

[1] Edit the run.bat file of JBoss to use the following debug options (note the suspend=n option, this tells the server not to wait till the debugger attaches itself to the server

set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n %JAVA_OPTS%

2) Start the server from the command line, using the run.bat file.

3) Once the server has completely started, i go to my (plain) Eclipse project and create a new "Remote Java Application" debug session (if it's not already created). In the "Port" text box i specify 8787 (the same as what i have in the run.bat). Then click on Debug.

The steps will be the same for NetBeans too (expect for the part where you have to configure NetBeans to listen to the debug port).