Code gets executed on the machine it runs on. For RMI the code is not transported to the client. When the client calls the method, RMI sends this request to the server. The server then executes the method, and sends any results / exceptions back to the client. Because the server executes the actual code the screenshot is created on the server.
If you need to take a screenshot of the client then the capturing code must occur on the client. The result can then be sent through RMI to the server, but keep in mind that this result must be serializable. BufferedImage isn't, but you can use ImageIO in combination with ByteArrayOutputStream to send convert the image to a byte, then use ImageIO with ByteArrayInputStream to convert the byte back into a BufferedImage. byte is serializable so you can use it as a parameter with RMI without a problem.
Hi Spoor, Thanks for the reply..
sorry to late reply as i was stuck in some other work.
i am not aware how do i execute the RMI block of code on client side. usually web application holds jsp as front end and how do i execute the RMI block of code on client side.
please let me know how do i do that..