Showing posts with label Eclipse. Show all posts
Showing posts with label Eclipse. Show all posts

Tuesday, July 31, 2012

Eclipse Starting with a Specific workspace


As I am working for different client at one given point of time, so sometimes it becomes cumbersome to switch the workspaces for different clients. Even sometime it is mandatory to open more than one eclipse and work with them in parallel. So managing them and switching between workspaces not only consumes times but also irritates.

I wanted to tackle this issue by creating different shortcuts for each workspace. Eclipse has easy solution for my problem.

To create shortcut to open eclipse with a particular workspace follow the steps mentioned below.

1. Browse to eclipse installation folder and right click on eclipse.exe.


2. You will see a shortcut at your desktop. Open the shortcut properties menu which pops up a shortcut properties.

3.In the target add the following text -data <YOUR_WORKSPACE_LOCATION>


4.Click on OK.

Now once you click on the shortcut, it would not prompt you to select the workspace and it will open the workspace associated to the location specified.
Now you can create as many as shortcut you want and refrain from switching between the different workspaces.

Saturday, May 12, 2012

Remote Debugging

Coding is simple, but it get tougher when something does not work as our normal human mind expects it to work. We wonder in woods, we shut the mind and go out for smoke, then we go to seniors to test their potential to attack and solve the problem and if every door closes on you then debugging comes to rescue each of us.
Now problem and tension aggravate when we could not find any issue on local machine whereas same code bombs at production environment. Oh god, no-one can really rescue the server and customer as some witch has modified the computer language to perform it abruptly.
Again we have rescuer. Different IDE can rescue us from this situation by using remote debugging. Local debugging is not as cumbersome as remote debugging. It takes few configurations to enable remote debugging.
Lets look into remote debugging configurations.

Configure Eclipse Project for Remote Debugging

Open Debug configurations under Run menu.

This will open a dialogue as shown below

Right click on REMOTE JAVA APPLICATION and click on new. It will open an editable box to configure properties for remote debugging.

Enter the name of the debug configuration. Do not forget to change the Host and port properties. Make the changes and click on apply button. Make sure to remember port number as this port number will be used at the time of configuring java application at server.

Apply the setting and closed the window.

Configure Java Application Running at Server
Actually you do not need any configurations. To run the java application you need to pass following JVM Options.
-Xdebug -Xrunjdwp:transport=dt_socket,address= {PORT_NUMBER_PASSED},server=y,suspend=y

 If earlier the command used to run java application was
java testJava
Now it will be modified to
java testJava -Xdebug -Xrunjdwp:transport=dt_socket,address={PORT_NUMBER_PASSED},server=y,suspend=y

Explanations
All options mentioned above will decide how application will run in debug mode.

Make a note of following points below:
* jdwp- (Java Debug Wire Protocol) this protocal enable your debugger(eclipse) to debug remote VM.
-Xrunjdwp: enables the jdwp for u
* -Xdebug  will start java application in debug mode .

Remaining jdb parameters will specify how application will run.
* suspend = y - Applicaion will not start until eclipse remotely connect to it.
* suspend =n - Application will start normally and it will stop at breakpoints
* transport = dt_socket will instruct jvm that debugger connections will be made through a socket
* server = n Attach to the debugger application at the specified address.
* server = y listen for connection at this address.
* 1044 is default port, this is transport address for connection.

This was simple but it may take some time to configure the application if you are running it for the first time. Have patient and try again it will work. There is not anything else you need to do. Configuring remote application has troubled me in the past and gives scare now also. But believe it is not rocket science.

Thursday, September 22, 2011

Eclipse/ANT Error Specified VM install not found



My company provided me new laptop and happily I moved from my old rusted desktop to new shining, powerful and portable laptop. Everything was copied without problem and I started working. But is not it strange to see everything working perfectly fine? I was stunned but happy as well. 

I started using the installed application. Eclipse was working fine until I tried building (Using ant) my application. Ant showed me a scary popup displaying "Specified VM Not found..." 



Simple solution, there is JDK/JRE problem with the system. Correct the JRE and JDK of the project. I did, but it did not work. I googled and found following 2 solutions.

You might even face this problem when you upgrade ant plug-in.

Solution 1
Remove the file which stores build information about the project and restart the eclipse. You can find the respective file in "${PROJECT_WORKSPACE}/.metadata/.plugins/org.eclipse.debug.core/.launches/${PROJECT_NAME} build.xml.launch"

Solution 2 (Location and Screen Shot may differ for different Eclipse Version. Following screen shot and paths are valid for Eclipse Version 3.7)

Go to RUN->External Tools ->External Tools Configurations… 


It will open console below. Select your build.xml(in my case it is abc build.xml). Move to JRE tab. 



Select the appropriate JRE.



Apply the changes and run the build xml. No need to restart eclipse, and you will not face the problem again.

Bmmm, Solved. Saved time.