Runtime class behaving erratic

hi all,
I am writing a simple network shell in java...it runs well for any dos commands but it doesn't executes a .exe file (using runtime class) while the program is active but when i quit the program the .exe file called before runs.
what's the problem...

                        else if(array.length == 2 && array[1] == ':'&& array[2] == '\\')
                               for (int index = 0; index < roots.length; index++)
                                    if(string1.equals(roots[index].toString()))
                                        System.setProperty("user.dir", string1);
                                        pwd = System.getProperty("user.dir");
                                        output.println(pwd);
                                        output.flush();
                        else if(array[0] == 'c' && array[1] == 'd' && array.length > 2)
                                   System.setProperty("user.dir", string1.substring(3));
                            //System.out.println(string1.substring(3));
                            pwd = System.getProperty("user.dir");
                            output.println(pwd);
                            //output.flush();
                        else if(string1.endsWith(".exe") || string1.endsWith(".avi"))
                            System.out.println(pwd+"\\"+string1);
                                   String run1 = pwd+"\\"+string1;
                                   /* Thread t = new Thread(new Run(run1));
                                   t.start(); */
                                   rtime.exec(run1);////******* HERE LIES THE PROBLEM @run1 path of the .exe file
                                   continue;
                              else
                                   commands[2] = string1;
                            p = rtime.exec(commands);                           
                            Scanner scan = new Scanner(p.getInputStream());
                                   String out = "";
                            while(scan.hasNextLine())
                                        out = out + scan.nextLine()+"~";
                                        //output.flush();
                            output.println(out);
                                   output.flush();
                              output.println("end");
                              output.flush();
        catch (IOException ex)
            ex.printStackTrace();
     public void run()
          try
               Runtime.getRuntime().exec(string);
          catch(IOException e)
    private static DatagramSocket clientSocket;
     private static MulticastSocket multiSocket;
    private static int boundPort = 8000;
    private static int multiPort = 5678;
     private static InetAddress group;
     private static String string = "active";
    private static String pwd;
     private static PrintWriter output;
    private static Scanner input;
    private static Process p;
    private static DatagramPacket packet;
}

Similar Messages

  • AS3 Tweens behaving erratically

    Hi,
    I've put together this simple code for an SWF with three roll over images (called: Training, Resources and Contact).
    When I roll over Training I would like the symbol Training_txt to tween its alpha to 1 (from 0) and tween its y axis to 220 (from 83).
    When I roll out of Training I would like to run the two tweens in reverse.
    This works fine for each of the three roll over images, so long as each tween is allowed to fully execute before a new tween is started.
    The problem arises if i quickly move the mouse curser between the three roll over images before the previous tweens have finished executing.
    In this instance, the tweened objects start to behave erratically. They usually return to their original position as per the roll_out tween but then start jumping between y axis 200 and y axis 83 (without tweening - they just appear).
    I'm pretty flummoxed. I have declared an individual variable for each tween this has not solved the problem. Also, I am now declaring the vars outside of the functions.
    Any help very much appreciated!
    Code below -
    stop();
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    //TWEEN VARS
    var Training_txt_alpha:Tween;
    var Training_txt_y:Tween;
    var Training_txt_alpha1:Tween;
    var Training_txt_y1:Tween;
    var Resources_txt_alpha:Tween;
    var Resources_txt_y:Tween;
    var Resources_txt_alpha1:Tween;
    var Resources_txt_y1:Tween;
    var Contact_txt_alpha:Tween;
    var Contact_txt_y:Tween;
    var Contact_txt_alpha1:Tween;
    var Contact_txt_y1:Tween;
    //TRAINING BUTTON
    Training.addEventListener (MouseEvent.ROLL_OVER,Training_Over);
    function Training_Over(event:MouseEvent):void {
    Training_txt_alpha = new Tween(Training_txt,"alpha",Strong.easeOut,0,1,1.5,true);
    Training_txt_y = new Tween (Training_txt,"y",Strong.easeOut,Training_txt.y,220,2,true);
    Training.addEventListener (MouseEvent.ROLL_OUT,Training_Out);
    function Training_Out (event:MouseEvent):void{
    Training_txt_alpha1 = new Tween(Training_txt,"alpha",Strong.easeIn,1,0,0.5,true);
    Training_txt_y1 = new Tween (Training_txt,"y",Strong.easeOut,Training_txt.y,83,1.5,true);
    //RESOURCES BUTTON
    Resources.addEventListener (MouseEvent.ROLL_OVER,Resources_Over);
    function Resources_Over(event:MouseEvent):void {
    Resources_txt_alpha = new Tween(Resources_txt,"alpha",Strong.easeOut,0,1,1.5,true);
    Resources_txt_y = new Tween (Resources_txt,"y",Strong.easeOut,Resources_txt.y,220,2,true);
    Resources.addEventListener (MouseEvent.ROLL_OUT,Resources_Out);
    function Resources_Out (event:MouseEvent):void{
    Resources_txt_alpha1 = new Tween(Resources_txt,"alpha",Strong.easeIn,1,0,0.5,true);
    Resources_txt_y1 = new Tween (Resources_txt,"y",Strong.easeOut,Resources_txt.y,83,1.5,true);
    //CONTACT BUTTON
    Contact.addEventListener (MouseEvent.ROLL_OVER,Contact_Over);
    function Contact_Over(event:MouseEvent):void {
    Contact_txt_alpha = new Tween(Contact_txt,"alpha",Strong.easeOut,0,1,1.5,true);
    Contact_txt_y = new Tween (Contact_txt,"y",Strong.easeOut,Contact_txt.y,220,2,true);
    Contact.addEventListener (MouseEvent.ROLL_OUT,Contact_Out);
    function Contact_Out (event:MouseEvent):void{
    Contact_txt_alpha1 = new Tween(Contact_txt,"alpha",Strong.easeIn,1,0,0.5,true);
    Contact_txt_y1 = new Tween (Contact_txt,"y",Strong.easeOut,Contact_txt.y,83,1.5,true);

    OK, I've managed to solve this issue by using a work-around.
    I've downloaded and installed the Tweener class, and I have to say I will be using this for my tweens from now on. (Google 'Tweener').
    Thanks for looking!

  • BCP data into a file using Runtime class

    Hi,
         I have a problem in using the Runtime class.
    I am trying to bcp a table's data into a file.I am working on a Unix environment.
    My bcp is not getting completed fully.The total records to be bcped is 1 million,but only one lakh records is getting bcped and then it hangs up..But if i issue the bcp command from my telnet session it is bcping it to the file without any problem.Can anyone help me out on how to overcome this..
    Is there anything specific with Runtime class..I am pasting the code that i tried out below.
    String l_s_bcpQuery="bcp mubstage.dbo.HousingUnitSampleMarket out /dun/d3nmb0/mariaps/subracheckprototype -c -t~ -Umariaps -Prykwz5ba -SD3NMB_MUB";
    try{
    Runtime time=Runtime.getRuntime();
    Process p=time.exec(l_s_bcpQuery);
    p.waitFor();
    System.out.println("The exit value is:"+p.exitValue());
    }catch(Exception ioe){
         ioe.printStackTrace();
         System.out.println("IOException"+ioe.getMessage());

    you might need to capture the stout & sterr from the process. see http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Process.html, or many other similar questions on this forum.
    try this:
    try{
    Runtime time=Runtime.getRuntime();
    Process p=time.exec(l_s_bcpQuery);
    BufferedReader stout = new BufferedReader(new InputStreamReader(p.getInputStream()));
    BufferedReader sterr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
    String out = stout.readLine();
    String err = sterr.readLine();
    while((out != null)||(err != null))
    if(out != null)
    System.out.println(out);
    if(err != null)
    System.err.println(err);
    out = stout.readLine();
    err = sterr.readLine();
    int exit_value = p.waitFor();
    System.out.println("The exit value is:"+ exit_value);
    }catch(Exception ioe){
    ioe.printStackTrace();
    System.out.println("IOException"+ioe.getMessage());
    }

  • Executing a command using Runtime Class

    How to execute a command on a differnet machine with different ipaddress using Runtime Class
    My code is
    String[] cmd = new String[3];
    cmd[0] = "192.1...../c:/WINNT/system32/cmd.exe" ;
    cmd[1] = "/C" ;
    cmd[2] = args[0];
    Runtime rt = Runtime.getRuntime();
    System.out.println("Execing " + cmd[0] + " " + cmd[1]
    + " " + cmd[2]);
    Process proc = rt.exec(cmd);
    // any error???
    int exitVal = proc.waitFor();
    System.out.println("ExitValue: " + exitVal);
    This is not Working

    I have same issue. Actually when I use cmd.exe /c set in java code and if I run the java code in DOS propmt, it retrieves all latest user Environment variable values. But if I run the code in windows batch file, it is not retrieveing the latest user environment values until I reboot my computer, Do you know how to get user environment value with out rebooting machine??????

  • FTP using Runtime class ...Please Help ??

    Hi,
    I am trying to ftp a file programatically.
    I am trying to use Runtime class but facing problems
    in it.This is what I am trying to do :
    Runtime rr = Runtime.getRuntime();
    String[] cmds = new String[2];
    cmds[0]="username=rahmed";
    cmds[1]="password=prpas";
    try{
    Process p = rr.exec("ftp 192.168.1.18",cmds);     
    rr.exec("put vv.txt");
    This does not work ??
    Is there any way to make it work ? Or is there any
    other way to ftp a file programatically ??
    Thanks in adavance..
    Regards
    Rais

    Under Linux/Unix at least, it is good to use the switches -n and -i with the ftp client acually meant for intercative usage.
    -i Turns off interactive prompting during multiple file transfers.
    -n Restrains ftp from attempting ``auto-login'' upon initial connection.
    I do "user <myuser> <mypassword>" then from the script.
    I am happily using ftp this way from shell-scripts in my projects.
    scp is however better than ftp: it does not send plain text passwords over the net, it support key-based login, its encrypts the data.

  • My magic mouse behaves erratically with intermittent problems - slows down, right click doesn't work, disconnects for a few seconds then reconnects. Anyone suggest what I could do to fix this?

    My magic mouse behaves erratically with intermittent problems - slows down, right click doesn't work, disconnects for a few seconds then reconnects. Anyone suggest what I could do to fix this?

    I just figured out the print quality issue for my wife with her new iMac and new printer.
    She replaced both at once and she couldn't understand why her Artisan 730 was lower quality then her Epson R280 when they had the same specs.
    Turns out the newer printer had the option to connect via wifi which we used during setup.
    The driver options are completely different depending on how you connect.
    Once I connected via USB the correct options were available and the print quality was better.
    Looking at the R2400 it dies not have wifi, but while researching the problem for my wife someone esle was having an issue updating to the latest printer driver.
    If you go into the print utility from the Printer and Scanner system preference and under the general tab you should have driver 5.5.
    One user had to delete the old printer driver before Software Update loaded the newer printer driver.
    https://discussions.apple.com/message/15947486#15947486
    On my MacBook Pro (w Snow Leopard) I always had to reconnect my wifi at home when it woke up. I upgraded my router from an old Netgear to a newer N D-Link and stopped having to do that.
    I would be surprised you would have that problem with an Airport Extreme, you might check to see if there is a firmware update for it.

  • Using Runtime class

    Hi,
    i would like to run a an external java program from within another java program,
    here is the structure of my called parogram
    c:/temp/jetty
    /lib/*.jar
    start.jar
    my caller program have to invoke the start.jar, but this jar uses the lib folder
    so my code construct a java command with the -cp options giving all the jar, and finally use th runtime class to call start.jar
    here is the code :
    String command = "java -cp D:/temp/jetty/lib/jetty-6.1.0.jar;D:/temp/jetty/lib/etc/another.jar -jar D:/temp/jetty/lib/jetty-6.1.0/start.jar"
    Runtime runtime = Runtime.getRuntime();     
    runtime.exec(command);
    it doesnt work, (classnot found error!!!) evenif i include in the cp option all the jar,
    my question is how to force the runtime to start the execution at c:/temp/jetty ??
    can anyone help

    Try this for ideas
    package testing;
    import java.io.IOException;
    public class Test
      public static void main(String[] args) throws IOException
        Runtime.getRuntime().exec("java -jar AnotherJar.jar");
    }and
    package testing;
    import javax.swing.JOptionPane;
    public class Another
      public static void main(String[] args)
         JOptionPane.showMessageDialog(null, "Another .jar running", "Blaa blaa", JOptionPane.INFORMATION_MESSAGE);
    }Then compile both, create manifests for both, create the jars (name the .jar corresponding to class Another as AnotherJar.jar), put the jars in the same directory and run the .jar that corrsponds to class Test.
    edit
    And obviously, in your case, you need to add the line
    Class-Path: lib/*.jar
    to the manifest of the program that needs the jar in directory lib.
    Message was edited by:
    duckbill

  • Since loading IOS7 my iPad behaves erratically

    Since loading ios7 my iPad behaves erratically with keyboard keys malfunctioning and screen size not containing viewable area. Please help.

    Try reset ur ipad......press home and power buttons same time until apple logo come up and then release it,no data is lost.

  • Java programming - Runtime class

    hi
    I am not able to copy a file using Runtime class in java.lang
    i have used
    Runtime rt = Runtime.getRuntime();
    Process pr = rt.exec("copy c:/venk1/pmrpay.jar F:/");
    pr.waitFor();
    when running the program i am getting this error message:
    create process: copy c:/venk1/pmrpay.jar F:/ error = 2
    kindly help me
    venkat

    There is no copy.exe on your system. Copy is command interpreted with command.com. So you need to try something like
    Process pr = rt.exec("cmd /c copy c:/venk1/pmrpay.jar F:/");
    See
    cmd /?
    for details... Hope this will help you!

  • Macbook Pro (mid 2012) inbuilt Track pad behaving erratically after fresh install of Yosemite 10.10.2

    I recently did a fresh install of the OS from online recovery. Mountain Lion was installed which I immediately upgraded to Yosemite 10.10.2. The trackpad started behaving erratically after two days. I seems that it started since I plugged one of my wifi router on the lan port. The trackpad is impossible to move as it seems to have a mind of its own. An external mouse connected works fine. Any help please !

    Try setting up another admin user account to see if the same problem continues. If Back-to-My Mac is selected in System Preferences, the Guest account will not work. The intent is to see if it is specific to one account or a system wide problem. This account can be deleted later.
    Isolating an issue by using another user account
    Try booting into the Safe Mode using your normal account.  Disconnect all peripherals except those needed for the test. Shut down the computer and then power it back up after waiting 10 seconds. Immediately after hearing the startup chime, hold down the shift key and continue to hold it until the gray Apple icon and a progress bar appear and again when you log in. The boot up is significantly slower than normal. This will reset some caches, forces a directory check, and disables all startup and login items, among other things. When you reboot normally, the initial reboot may be slower than normal. If the system operates normally, there may be 3rd party applications which are causing a problem. Try deleting/disabling the third party applications after a restart by using the application un-installer. For each disable/delete, you will need to restart if you don’t do them all at once.
    Safe Mode - About
    Safe Mode - Yosemite

  • Scrubby sliders in the Lens Blur Filter in PS CC 2014 behaving erratically.

    The scrubby sliders in the Lens Blur Filter in PS CC 2014 are behaving erratically. In PS CC no problems. I may be mistaken, but I think I read somewhere that this filter only works on 8bit images.
    In PS CC it works on 16bit, and in PS CC 2014 (no third-party plugins) nothing works. Could this have something to do with the Graphic Card, or Cache Levels? All advice appreciated.

    Sorry, no solution to the problem, but a confirmation. I do have the same problem (Intuos Pro and Pen & Touch) showing the problem with ACR 8.5 and Photoshop (2014, CC and 6, these were updated with ACR 8.5) . No such problem before ACR 8.5 and no problem with LR 5.5 (also containing ACR 8.5).
    I hope there will be a solution from Adobe soon, since sems to be caused by the ACR update.
    Windows 8.1 in my case and latest Wacom Intuos driver installed.
    Thomas

  • How to fix: photos are behaving erratic or connected to each other

    Please help as I'm stymied! My Mac PS CS5.5, vs. 12.1 is behaving strange when more than one photo is open. I don't like tabs, so I've turned that off in preferences. I need to have several photos open at once, and like to spread them over the desktop to see them all at the same time. When I click on one photo, the others are behaving erratically: some are changing to show the same photo I clicked on or part of it. It's as if each window is connected. How do I turn that off or otherwise fix the problem, so that I can view each individual photo and even make changes to it, without it effecting the other open photos?
    I have already tried rebooting and deleting the settings file by booting PS while holding down the command, option, and shift buttons. And I checked for updates, but looks like I have the latest.
    Thx, Cindy

    Thanks for your answer. I tried fixing the following, but it didn't fix the problem.
    This is a brand new copy of Photoshop. Previous copies have worked fine on this computer. I just went to preferences/performance and changed the memory usage allowance up to 89%--think it was at 70%, and made an external drive with 1000GB extra space another scratch disk. Then re-launched PS. Problem is still there and happens even if I only have two photos open, plus no other software besides internet browser open.
    The mac is a fairly new tower with 6gb ram. Not sure how to find out which video card I have, but I did purchase the upgrade.
    Thoughts?

  • Get runtime class and cast object to it?

    Hi,
    public interface Msg
    Msg msg=msgLib.get(msgType);
    Msg msg2=msg.clone(); //problem! cannot find clone in  x.y.Msg!
    ...Shouldn't msg be resolved to the implementing class (MsgReply for example) and use the "clone()" method, that i have declared in that class -which overrides the one of Object class?
    If no, is there a way to find the runtime class -probably use "getClass"- and cast to it? How?
    Thanks

    There are many implementing classes; i want to get the runtime class. Something like:
    (msg.getClass())msg.clone();
    Message was edited by:
    uig

  • Mac book pro trackpad and arrow keys behaving erratically

    Hi,
    Over the past few months I've noticed my track pad and arrow keys not working as they should and the problem has been getting worse until a few days ago the trackpad stopped working all together only for it to come back to life for a few hours then get worse again.
    Symptoms:
    The cursor keep sticking, you can't drag it smoothly across the screen.It'll suddenly jump to the top of the screen or you can only move it left and right not up and down.
    The main click stops working, it'll turn into a right click button so everytime you click I get a sub menu pop up.
    When I use the arrow keys to navigate a sub menu the highlight jumps around as if it's possesd.
    Sometimes I'm not touching anything and the cursor will move on it's own!?!
    I've tried resetting the PRAM but it doesn't work. Everytime I restart the mac book it works fine for a little while then gets worse again.
    Does anyone have a suggestion as to what's wrong with it?
    Thanks
    Chris

    The possible cause could be your List is too lengthy. What you can do is don't refresh the list when they press the key down but put a Button beside. Once they selected the value in the dropdown then hey click the Button to get whatever needed.
    chanmm
    chanmm
    Thanks - how would I do that?
    I am thinking that another possibility is the FirstOrDefault
    command that runs in the FocusItem method. I think that it is causing any arrow key (up/down) interaction to behave erratically, but I don't know what to use in its place.

  • Imadmin domain purge behaving erratic

    We are facing problems while deleting a domain created through the delegated admin.
    it is saying container already exists while purging the domain through the command line,
    1.after deleting all the users and groups from that domain.
    2.after giving the -g0 option of imadmin domain purge
    3.after deleting o=internet suffix through the ldapdelet utility.
    really it is behaving erratically.We are unable to create the domain with the same name again.Hope everybody else also faced the same problem while going through the archives.Does somebody got any solution or this is a Bug from SUN, where they created like this????
    this is Quiet urgent.Please help immediately.

    Reply from Bruce Bergeron:
    Anyways, I assume you delete the users with "imadmin user
    delete" and then purge them with "imadmin user purge". Once
    this is done then you no longer have the users mailboxes or the
    users entries in ldap.
    After this you should be able to do "imadmin domain purge" ok.
    You said you then deleted o=internet. Why?
    o=internet contains the dc tree and should not have to be deleted.
    But if you assume you do not delete the o=intetnet dit then you
    should be able to recreate another domain with the same name.
    I tested this out on iMS 5.2 hf 1.21 with iDA 1.2 hf 1.3 and did not
    have a problem. iDA 1.2 hf 1.5 is out now.
    So iDA functions just fine. What versions of iMS and iDA are you
    using?

Maybe you are looking for

  • Third party DVCPROHD Frame Rate Converter not showing up in tools.

    How can I get a third party frame rate converter to appear in my FCP tools. I meet all system requirements... followed instructions. Not sure what is up. Any ideas?

  • JTable question

    I'm implementing the code from Manning's Swing book. The table is rendered correctly but the table model is not saving the edit changes. After a sort or save to a file, I don't see the changes made in the cells. The table is getting refreshed properl

  • ORAPWD

    hi a question about ORAPWD.....we create password file using oradim command while creating a database.. then what is the need for ORAPWD.....because when we create password file we don tell it any database this file should belong.... and second thing

  • Itunes screen size

    This has probably been asked before but why can't itunes go full screen ?

  • Where is the iview?

    I added an iView as a delta link to a page. When I open the page in the Portal Content Studio and look at the ID property of the iview added, it shows me an ID in the form of:: <pcd path of the page>/<pcd path of the original iView> but there is no p