Sunday, January 25, 2009

Remote debugging application on pocket pc running on j9

I assume that eclipse was used for the development of the application. Once the application is ready, It shall be copied over to the device that has j9 run time environment. The application can be deployed as a jar file or classes. In order to run the application, either command line needs to be used or we can create a link file with the following content:
255#"\Program Files\j9\bin\j9.exe" -jcl:ppro11  -cp "Test.jar" "trial.Test"
Assuming that the application is packed into a jar file and the trail.Test is the main class. Save the above file with a .lnk extension e.g. Test.lnk. Click on the Test.lnk file and see that the application launches properly.
Now in order to remote debug, check for the existence of j9dbg23.dll in your j9 bin directory. Modify the Test.lnk file to:
255#"\Program Files\j9\bin\j9w.exe" -jcl:ppro11 -debug:transport=dt_socket,server=y,address=4142 -cp "Test.jar" "trial.Test"
Once it is done, open the same project in eclipse.
  1. Open the Debug Configurations window (Run > Debug Configuration).
  2. Create a new Remote Java Application configuration and enter the details as follows:
  • Project -> Select your project.
  • Connection Type -> Standard (Socket Attach)
  • Connection Properties -> ip of the remote machine (pocket pc) and the debug port (4142 in our example case). This port is mentioned in the above created ".lnk" file, hence should be the same in this "Remote Java Application" debug configuration.
  • Run the application on the pocket pc by clicking on the Test.lnk file.
  • Click on the Debug button on the newly created "Remote Java Application" debug configuration.
You are ready to debug your application buy putting break points in appropriate code locations. This scenario has been tested with j9 on a Windows CE 4.2 environment. Should be the same for Windows Mobile and Linux environment (you'll get an .so instead of a .dll in j9 distribution).
The debugger can similiarly be attached even using netbeans.

2 comments:

  1. i need help with a java problem, i see your skilled?

    ReplyDelete
  2. Where does j9dbg23.dll come from?
    Is that part of the standard install?

    ReplyDelete