Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Run 2 systems command in applet, how?

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Run 2 systems command in applet, how?

    I have an applet in which the following code works fine on a windows machine for a VM windows-based router I am developing:

    Process f;
    String cmd="tftp -i 192.168.1.101 GET router_image.exe";
    try{
         f=Runtime.getRuntime().exec(cmd);
    }

    But I also need to add a 5 second pause and then run the router_image.exe.

    Using the above commands (or modifications thereto), is this possible? If so, what would need to be done.

    Thanks.
    Last edited by Freaky Chris; April 8th, 2010 at 10:50 AM. Reason: Added code tags, moved


  2. #2
    Senile Half-Wit Freaky Chris's Avatar
    Join Date
    Mar 2009
    Posts
    834
    My Mood
    Cynical
    Thanks
    7
    Thanked 105 Times in 90 Posts

    Default Re: Run 2 systems command in applet, how?

    Welcome to Java Prograaming Forums. Try to post in the correct place and use code tags please.

    Thread.getCurrentThread().sleep(5000);
    Runtime.getRunetime().exec(cmdTwo);

    Regards,
    Chris

  3. #3
    Junior Member
    Join Date
    Apr 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Run 2 systems command in applet, how?

    Quote Originally Posted by Freaky Chris View Post
    Welcome to Java Prograaming Forums. Try to post in the correct place and use code tags please.

    Thread.getCurrentThread().sleep(5000);
    Runtime.getRunetime().exec(cmdTwo);

    Regards,
    Chris
    Please see next post. Thank you.
    Last edited by bulgin; April 8th, 2010 at 03:12 PM.

  4. #4
    Junior Member
    Join Date
    Apr 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Run 2 systems command in applet, how?

    Here is the code in it's totality that works, minus the pause and second command:

    import java.applet.*;
    import java.awt.*;
    import java.io.*;
    public class ROUTERcmd extends Applet {
    public void init() {
    Process f;
    String cmd = "tftp -i 192.168.1.101 GET router_image.exe";
    try {
    f = Runtime.getRuntime().exec(cmd);
    }
    catch(IOException e) {
    e.printStackTrace();
    }
    Process s;
    }
    }

    So I cannot figure out where to include the other commands, i.e., execute the router_image.exe after a 5 second pause.

    Any help much appreciated.

Similar Threads

  1. [SOLVED] Command Line Argument Help
    By EmSaint in forum Loops & Control Statements
    Replies: 2
    Last Post: January 28th, 2010, 10:55 AM
  2. Multi-Valued Command Line Arguments
    By joey86 in forum Java Theory & Questions
    Replies: 1
    Last Post: December 29th, 2009, 11:19 AM
  3. Code wise working of Computer Algebra Systems
    By helloworld922 in forum Java Theory & Questions
    Replies: 1
    Last Post: July 7th, 2009, 07:45 AM
  4. opening Telnet Command Session
    By voyager in forum Java Networking
    Replies: 3
    Last Post: June 23rd, 2009, 10:34 AM
  5. How to Send command line arguments in Eclipse?
    By JavaPF in forum Java JDK & IDE Tutorials
    Replies: 0
    Last Post: April 23rd, 2009, 11:37 AM