Results 1 to 2 of 2
  1. #1
    Ericyue is offline Member
    Join Date
    Mar 2012
    Posts
    18
    Rep Power
    0

    Default cannot find symbol

    hi ,

    i writing a program to let it print screen and send to others pc , below is my code :

    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.lang.*;
    import java.awt.Toolkit;
    import java.util.Timer;
    import java.util.TimerTask;
    import java.awt.image.BufferedImage;
    import java.awt.Rectangle;
    import java.awt.Dimension;
    import java.awt.Robot;
    import java.io.File;
    import javax.imageio.ImageIO;

    public class testRSH implements Runnable
    {
    private StreamHandlers streamHandlers = new StreamHandlers();

    public testRSH(){}

    Toolkit toolkit;
    Timer timer;
    public void run()
    {

    class RemindTask extends TimerTask {

    public void run() {

    try {
    Toolkit tool = Toolkit.getDefaultToolkit();

    Dimension d = tool.getScreenSize();
    Rectangle rect = new Rectangle(1024,768);
    Robot robot = new Robot();
    Thread.sleep(1000);


    File f = new File("screenshot.jpg");
    BufferedImage img = robot.createScreenCapture(rect);
    ImageIO.write(img,"jpeg",f);


    } catch(Exception e){}




    }//close public void run
    }//close class Reminder

    };

    public void test()
    {
    try
    {
    //Function call to capture the screen
    run();

    //Function call to set the RSH execution command
    executionCommand = sshFileRSH("192.168.1.104", "pc2", "screenshot.jpg ", "/home/pc2/Desktop", "/home/pc3/Desktop");

    //Run teh RSH command
    Process p1 = Runtime.getRuntime().exec(executionCommand);
    InputStreamReader isr = new InputStreamReader(p1.getInputStream());
    streamHandlers.checkStreamOutput("From RuntimeExecution", isr);

    }
    catch(Exception e)
    {
    System.out.println("Error in RuntimeExecution: " + e);
    }
    }

    //Function to set the RSH SCP command
    private String sshFileRSH(String hostName, String userName, String localFileNames, String remoteDirName, String localJobDirectory)
    {
    String fileTransferCommand = "scp " + localFileNames;
    //String fileTransferCommand = "rsync --partial --progress --rsh=ssh " + localFileNames[0] + " " + localFileNames[1] + " " + localFileNames[2];

    String destinationCommand = userName + "@" + hostName + ":" + remoteDirName;

    String executionCommand = "";
    executionCommand = fileTransferCommand + " " + destinationCommand;

    return executionCommand;
    }
    }

    when i try to compile , i get a error as below:

    testRSH.java:60: cannot find symbol
    symbol : variable executionCommand
    location: class testRSH
    executionCommand = sshFileRSH("192.168.1.104", "pc2", "screenshot.jpg ", "/home/pc2/Desktop", "/home/pc3/Desktop");
    ^
    testRSH.java:63: cannot find symbol
    symbol : variable executionCommand
    location: class testRSH
    Process p1 = Runtime.getRuntime().exec(executionCommand);
    ^
    2 errors


    can anyone tell me what is the problem ? i have google it a lot but i still dun understand why cannot find symbol .

    thanks in advance for the reply ..

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: cannot find symbol

    Go through the forum FAQs and discover how to post code so that it retains its formatting.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Cannot Find Symbol
    By Promisha in forum New To Java
    Replies: 10
    Last Post: 03-30-2011, 03:11 AM
  2. Cannot find symbol
    By Johanis in forum New To Java
    Replies: 19
    Last Post: 11-04-2010, 09:13 PM
  3. Still cannot find symbol!
    By Johanis in forum New To Java
    Replies: 1
    Last Post: 11-04-2010, 05:32 PM
  4. Replies: 9
    Last Post: 10-18-2008, 09:26 PM
  5. Replies: 3
    Last Post: 05-01-2008, 09:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •