I am getting a very strange result when I try to run some java screen capture code from coldfusion. When I simply run the .java file (#2 below) I get a great .png screen shot stored here: c:\screenshotFromJava.png
However, when I run the .cfm page (#1 below) using createObject I get the same size .png file that is completely black. To test this, compile the .java file below and place the .jar file in the lib directory, then restart the cf service. 1. ColdFusion page that calls the JAR _________________________________________________________ <cfscript> objMouse = createObject('java','robotScreenShot').init(); objMouse.screenShot("screenshotFromCF.png"); </cfscript> Screen shot created here: c:\screenshotFromCF.png _________________________________________________________ 2. .java file import java.awt.Robot; import java.awt.AWTException; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.Dimension; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; import java.io.File; import java.io.IOException; public class robotScreenShot { public static void main(String[] args) throws AWTException{ screenShot("screenshotFromJava.png"); } public static void screenShot(String pngFileName) throws AWTException{ try { Robot r = new Robot(); String pngPath = "c:\\" + pngFileName; Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Rectangle rect = new Rectangle(0, 0, screenSize.width, screenSize.height); BufferedImage img = r.createScreenCapture(rect); ImageIO.write(img, "png", new File(pngPath)); } catch (AWTException e) { System.err.println(e); } catch (IOException e) { System.err.println(e); } } } I would really appreciate any help. Thanks, Ryan Duckworth 913.486.2611 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:225164 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54