Need help with Runtime.exec()

I need help getting my program to run a different java program through the command prompt using the runtime.exec() method. This is my code so far:
import javax.swing.JOptionPane;
import javax.swing.JDialog;
import javax.swing.JButton;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import javax.swing.BoxLayout;
import javax.swing.Box;
import javax.swing.BorderFactory;
import javax.swing.border.Border;
import javax.swing.JTabbedPane;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.*;
//import java.Original.*;
//import java.Turtle.*;
//import jav.Turtle.galapagos.*;
public class JavaMenu extends JPanel
     JFrame frame;
     JLabel label;
     JButton select;
     String labDescription = "Java labs created in class.";
     String turtleDescription = "Turtle labs created in class";
     String creationDescription = "Java programs created on my own.";
     public JavaMenu(JFrame frame)
          super(new BorderLayout());
          JPanel lab = labDialog();
          //JPanel turtle = turtleDialog();
          //JPanel creation = creationDialog();
          label = new JLabel("Click Select Program to run the program.", JLabel.CENTER);
          this.frame = frame;
          Border padding = BorderFactory.createEmptyBorder(20,20,5,20);
          lab.setBorder(padding);
          //turtle.setBorder(padding);
          //creation.setBorder(padding);
          JTabbedPane tab = new JTabbedPane();
          tab.addTab("Java Labs", null, lab, labDescription);
          //tab.addTab("Turtle Labs", null, turtle, turtleDescription);
          //tab.addTab("Java Programs", null, creation, creationDescription);
          add(tab, BorderLayout.CENTER);
          add(label, BorderLayout.PAGE_END);
          label.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
     void setLabel(String newText)
          label.setText(newText);
     protected static ImageIcon createImageIcon(String path)
        java.net.URL imgURL = JavaMenu.class.getResource(path);
        if (imgURL != null) {
            return new ImageIcon(imgURL);
        } else {
            System.err.println("Couldn't find file: " + path);
            return null;
     private JPanel labDialog()
          final int numButtons = 25;
          JRadioButton[] javalabs = new JRadioButton[numButtons];
          final ButtonGroup group = new ButtonGroup();
          select = null;
          final String messageCommand2 = "Lab 02";
          final String messageCommand3 = "Lab 03";
          final String messageCommand4 = "Lab 04";
          final String messageCommand41 = "Lab 04 Extra Credit 1";
          final String messageCommand42 = "Lab 04 Extra Credit 2";
          final String messageCommand5 = "Lab 05";
          final String messageCommand51 = "Lab 05 Extra Credit";
          final String messageCommand6 = "Lab 06";
          final String messageCommand6b = "Lab 06";
          final String messageCommand7 = "Lab 07";
          final String messageCommand71 = "Lab 07 Extra Credit";
          final String messageCommand8 = "Lab 08";
          final String messageCommand8b = "Lab 08";
          final String messageCommand81 = "Lab 08 Extra Credit";
          final String messageCommand9 = "Lab 09";
          final String messageCommand9b = "Lab 09";
          final String messageCommand91 = "Lab 09 Extra Credit 1";
          final String messageCommand92 = "Lab 09 Extra Credit 2";
          final String messageCommand93 = "Lab 09 Extra Credit 3";
          final String messageCommand9a = "Lab 09 American Flag";
          final String messageCommand9t = "Lab 09 Texas Flag";
          final String messageCommand0 = "Lab 10";
          final String messageCommand0b = "Lab 10 Hi Lo Game";
          final String messageCommand01 = "Lab 10 Extra Credit 1";
          final String messageCommand02 = "Lab 10 Extra Credit 2";
          javalabs[0] = new JRadioButton("Lab 02 100 Point Version");
          javalabs[0].setActionCommand(messageCommand2);
          javalabs[1] = new JRadioButton("Lab 03 100 Point Version");
          javalabs[1].setActionCommand(messageCommand3);
          javalabs[2] = new JRadioButton("Lab 04 100 Point Version");
          javalabs[2].setActionCommand(messageCommand4);
          javalabs[3] = new JRadioButton("Lab 04 Extra Credit 1");
          javalabs[3].setActionCommand(messageCommand41);
          javalabs[4] = new JRadioButton("Lab 04 Extra Credit 2");
          javalabs[4].setActionCommand(messageCommand42);
          javalabs[5] = new JRadioButton("Lab 05 100 Point Version");
          javalabs[5].setActionCommand(messageCommand5);
          javalabs[6] = new JRadioButton("Lab 05 Extra Credit");
          javalabs[6].setActionCommand(messageCommand51);
          javalabs[7] = new JRadioButton("Lab 06A 100 Point Version");
          javalabs[7].setActionCommand(messageCommand6);
          javalabs[8] = new JRadioButton("Lab 06B 100 Point Version");
          javalabs[8].setActionCommand(messageCommand6b);
          javalabs[9] = new JRadioButton("Lab 07 100 Point Version");
          javalabs[9].setActionCommand(messageCommand7);
          javalabs[10] = new JRadioButton("Lab 07 Extra Credit");
          javalabs[10].setActionCommand(messageCommand71);
          javalabs[11] = new JRadioButton("Lab 08A 100 Point Version");
          javalabs[11].setActionCommand(messageCommand8);
          javalabs[12] = new JRadioButton("Lab 08B 100 Point Version");
          javalabs[12].setActionCommand(messageCommand8b);
          javalabs[13] = new JRadioButton("Lab 08 Extra Credit");
          javalabs[13].setActionCommand(messageCommand81);
          javalabs[14] = new JRadioButton("Lab 09A 100 Point Version");
          javalabs[14].setActionCommand(messageCommand9);
          javalabs[15] = new JRadioButton("Lab 09B 100 Point Version");
          javalabs[15].setActionCommand(messageCommand9b);
          javalabs[16] = new JRadioButton("Lab 09 Texas Flag");
          javalabs[16].setActionCommand(messageCommand9t);
          javalabs[17] = new JRadioButton("Lab 09 American Flag");
          javalabs[17].setActionCommand(messageCommand9a);
          javalabs[18] = new JRadioButton("Lab 09 Extra Credit 1");
          javalabs[18].setActionCommand(messageCommand91);
          javalabs[19] = new JRadioButton("Lab 09 Extra Credit 2");
          javalabs[19].setActionCommand(messageCommand92);
          javalabs[20] = new JRadioButton("Lab 09 Extra Credit 3");
          javalabs[20].setActionCommand(messageCommand93);
          javalabs[21] = new JRadioButton("Lab 10 A 100 Point Version");
          javalabs[21].setActionCommand(messageCommand0);
          javalabs[22] = new JRadioButton("Lab 10 B 100 Point Version");
          javalabs[22].setActionCommand(messageCommand0b);
          javalabs[23] = new JRadioButton("Lab 10 Extra Credit 1");
          javalabs[23].setActionCommand(messageCommand01);
          javalabs[24] = new JRadioButton("Lab 10 Extra Credit 2");
          javalabs[24].setActionCommand(messageCommand02);     
          for (int k = 0; k < numButtons; k++)
               group.add(javalabs[k]);
          javalabs[0].setSelected(true);
          select = new JButton("Select Program");
          select.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent e)
                    String command = group.getSelection().getActionCommand();
                    if (command == messageCommand2)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                             try
                                Runtime.getRuntime().exec(new String[] {"cmd", "set classpath=D:/Documents and Settings/Yinon Michaeli/My Documents/CS/java/Labs02", "path C:/j2sdk1.4.0/bin", "java Lab020"});
                                //File file = new File("java/Labs02");
                                //Runtime.getRuntime().exec(new String[] {"rundll32", "url.dll,FileProtocolHandler","file:///" + file.getAbsolutePath()});
                             catch (Exception a)
                                  JOptionPane.showMessageDialog(frame, "Error: Exception.", "Error", JOptionPane.ERROR_MESSAGE);
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand3)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand4)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand41)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand42)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand5)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand51)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand6)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand6b)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand7)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand71)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand8)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand8b)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand81)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand9)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand91)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand9t)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand9a)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand9b)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand92)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand93)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand0)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand0b)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand01)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    if (command == messageCommand02)
                         int confirm = JOptionPane.showConfirmDialog(frame, "You are about to run the program, o.k.?", "Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
                         if (confirm == JOptionPane.YES_OPTION)
                              setLabel("Awesome!");
                         else if(confirm == JOptionPane.NO_OPTION)
                              setLabel("You've got to be kidding!");
                    return;
          return create2ColPane(labDescription + ":", javalabs, select);     
     private JPanel createPane(String description, JRadioButton[] radioButtons, JButton showButton)
          int numChoices = radioButtons.length;
        JPanel box = new JPanel();
        JLabel label = new JLabel(description);
        box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
        box.add(label);
        for (int k = 0; k < numChoices; k++)
            box.add(radioButtons[k]);
        JPanel pane = new JPanel(new BorderLayout());
        pane.add(box, BorderLayout.PAGE_START);
        pane.add(showButton, BorderLayout.PAGE_END);
        return pane;
    private JPanel create2ColPane(String description, JRadioButton[] radioButtons, JButton showButton)
        JLabel label = new JLabel(description);
        int numPerColumn = radioButtons.length/2;
        JPanel grid = new JPanel(new GridLayout(0, 2));
        for (int k = 0; k < numPerColumn; k++)
            grid.add(radioButtons[k]);
            grid.add(radioButtons[k + numPerColumn]);
        JPanel box = new JPanel();
        box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
        box.add(label);
        grid.setAlignmentX(0.0f);
        box.add(grid);
        JPanel pane = new JPanel(new BorderLayout());
        pane.add(box, BorderLayout.PAGE_START);
        pane.add(showButton, BorderLayout.PAGE_END);
        return pane;
    private static void createAndShowGUI()
         JFrame.setDefaultLookAndFeelDecorated(true);
         JFrame frame = new JFrame("Java Programs");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JavaMenu newContentPane = new JavaMenu(frame);
        newContentPane.setOpaque(true);
        frame.setContentPane(newContentPane);
        frame.pack();
        frame.setVisible(true);
    public static void main(String[] args)
         javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
}

Why are you posting hundreds of lines of code not related to the problem??? 99.9% of the code you posted has absolutely nothing to do with using the Runtime.exec() method.
Create a simple test program that simply tries to invoke the Runtime.exec() method. Once you get that working, then you incoporate it into you real program. Don't clutter the forum with unnecessary code.
public class WindowsFileProtocolHandler
     public static void main(String[] args)
          throws Exception
          String[] cmd = new String[4];
          cmd[0] = "cmd.exe";
          cmd[1] = "/C";
          cmd[2] = "java";
          cmd[3] = "YourClassHere";
          Process process = Runtime.getRuntime().exec( cmd );
}

Similar Messages

  • Need help with runtime exe command

    Does anybody know how to get the command with double quotes to work with runtime exe?
    String cmd = s+" "+fileName;
    fin = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exe(cmd).getInputStream()));
    if my s is 'grep -i RTU', the fin would have correct value.
    but if my s is 'grep -i "RTU"', the fin doesn't have anything (nothing return from exe(cmd) ).
    I tried printing out the cmd, it looks fine ( grep -i "RTU" filename ).
    Even when I copy the print of cmd and execute it on unix prompt, it return correct value too.
    I also tried excaping double qoutes with backslash. Still doesn't work.
    Thank you so much in advance

    I tried with the exec(String[]) instead of
    exec(String).
    Still doesn't work.
    I'm using Java 2 SDK, Standard Edition Version
    1.3.1_02I am afraid I can't help. I can't duplicate your problem - I have no difficulty passing arguments with or without quotation marks using JDK 1.3. I just wrote a test to be sure, and it worked fine.

  • Need help with Runtime class in UNIX

    I am attempting to kick off a C++ executable from within java. This class is called through a UI.
    The executable runs in the form of the exec followed by name=value pairs, ie [path/exec] [n=v] [n=v] ... and runs fine from the command line.
    Examples: These don't kick it off, but don't error either.
    String cmd[] = {"/bin/sh","-c","[path]/[exec] [n=v]};
    String cmd[] = new String[3];
    cmd[0] = "[path]/[exec]";
    cmd[1] = "[n=v]";
    cmd[2] = "[n=v]";
    Process p = Runtime.getRuntime().exec(cmd);
    I'm thinking it may be an environment issue, ie env vars not set because the only way I can get this to work is to put the command in a shell script that sets the env vars and kicks off the executable. Like:
    String cmd[] = {"/bin/sh","-c","/[path]/test.sh"};
    I'd prefer to kick this off from the java code. It sounds like I need to find a way to shell out, run our script to set env vars, then kick off the exec. This is my first attempt w/ using Runtime, so maybe I'm missing something.
    Thanks in advance for the help.

    I think this sort of thing will depend upon the shell you're in. When you use Runtime.exec you (might) lose your "parent" shell's environment variables - this question shows up here now and again, here's one thread that might help:
    http://forum.java.sun.com/thread.jspa?threadID=468648&messageID=2172572
    You might find some enlightenment on Roedy's Java Glossary here: http://mindprod.com/jgloss/exec.html
    Hope that helped
    Lee

  • Need Help with getRuntime.exec()!!!

    I'm stuck and i could use some assistance. When I use Runtime.getRuntime.exec("regedit.exe /e ... HKEY_LOCAL_MACHINE\\SOFTWARE")
    where ... is some directory path like C:\Documents and Settings\
    It doesnt work becuase the "Documents and Settings" either:
    #1, is too long
    #2, has spaces in it.
    What would be the solution to this without having to do some crazy string manipulation? The location of the directory path I want the registry file to export to is stored in a String that is used in many places and changes all the time. Thanks

    This is happening because Runtime.exec is breaking up your path into three separate arguments.
    You can use the version of .exec that takes a String array for the command:
    String myCommand = new String[3];
    myCommand[0]="regedit.exe /e"
    myCommand[1]="C:\Documents and Settings\...";
    myCommand[2]="HKEY_LOCAL_MACHINE\\SOFTWARE";
    Runtime.exec(myCommand,null, null);

  • Need help with Runtime.getRuntime().exec

    If there is a better place to post please let me know. I need some help understanding what is going on and was hoping someone might be able to provide some information. I would like to use Runtime.getRuntime().exec to copy a file in linux. Here is the code I am using:
    try {
    Process p = Runtime.getRuntime().exec("cp -v foo foo2");
    BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line = null;
    while ((line = in.readLine()) != null) {
    System.out.println(line);
    } catch (IOException e) {
    e.printStackTrace();
    If I use cp, with the System.out.println(line) I can see that it has copied and of course when I check the command line indeed it has. My problem is that I really need to use the dd command, but I can't see the output that dd displays. It copies the file just fine but I need the output. If someone can provide some explaination or help I would really appreciate it. Thanks.

    By default, dd sends its output to stdout, so any status messages it has go to stderr. Use getErrorStream (double check the docs for the method name) just like you're currently using getInputSTream.

  • Not a developer but need help with runtime error, please

    Hi, I have downloaded a game called Fishdom, but it will not open. I get a " The application has requested the Runtime to terminate it in an unusual way" error message. The dialog box is labeled "Microsoft Visual C++ Runtime Library". 
    I checked my programs and I have C++ '05, '08, and 2010. I am using XP SP3.  I don't get this error at any other time.
    I have asked Playrix (game distributor) about it and they seem relatively clueless about how to fix it. So, is there anything I can do to fix this error, or bypass the error so that the game will load? I've tried deleting and reinstalling the libraries and
    that did not help.
    Anything you can suggest will be very helpful, because I do want the game and do not want to argue with them about refunding my money for it.

    Hi CatsinQ,
    Thank you posting in MSDN forum.
    According to your description, could you please tell us when you installed the
    Microsoft Visual C++ Runtime Library if there have any install errors?
    If you can install the Microsoft Visual C++ Runtime Library successfully, I think that the issue is more related to the game. Therefore, I suggest you can ask the issue to Playrix
    (game distributor), maybe it will better help you.
    In addition, since the
    Visual Studio General
    Forum which discuss Visual Studio the VS IDE issue, so I suggest you can try Brian’s suggestion.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

  • Need help with Runtime error! Can't find "MediaDatabase" file! Folders are visible!

    Hi, I have been searching a lot for an answer to this issue. Elements keeps crashing after about five minuets and giving me "Microsoft Visual C++ Runtime Library" "Runtime Error!" "R6025 - pure virtual function call". I am running Premiere Elements 9.0 on windows 8.1 and I am trying to
    rebuild the "mediadatabase.db3" file, but cannot find it. I made my hidden folders visible, and followed the pathway, but I only get this. I have searched and searched but I can't find anything about windows 8.1. Only 7 and vista. Thanks in advance!

    Look for a line that resembles the following in the
    actionscript of the Flash fla files... It is likely to be in the
    first frame's code, but may not be.
    xmlData.load("teamTSI_en.xml");
    the '
    xmlData' part of that is not likely to be the same as what's
    in your file, it's a variable so it could be anything, and the file
    names will be whatever your xml files are.
    If you can post that line of code from each of the fla files,
    someone may be able to tell you where you need to place the xml
    files.

  • NEED HELP WITH RUNTIME ERROR!

    I have recently formated my laptop and installed Adobe Reader. Every time I try to open a .pdf I get the message below:
    Runtime Error!
    Program: c:\program files\adobe\reader 9.0\readeacroRd32.exe
    This application has requested the Runtime to terminate it in an unusual way. Please contact the applications support team for more information.
    I always click to report it to windows but there is no link to fix this issue. What can I do?
    Thanks.

    That hotfix applies to XPSP2. Is that what you've installed? If so,
    you should probably upgrade to SP3, which includes a later version
    of that and many other msvc files. If you're not using XP, then
    that's not the solution.
    Noel

  • Need help with almost completed plugin engine project

    Hi all,
    For a while now I have been working on a plugin engine. After a few iterations, the engine is similar to the Eclipse engine, in that plugins use extension points and extensions to allow contributions. Unlike the eclipse engine I have added the ability for plugins to fire events through the engine and other plugins can add listeners, all through the plugin.xml manifest. Dependencies are mostly handled automatically at plugin load time (when extensions get resolved to extension points, and listeners get resolved to events). For the case where a plugin needs to use classes from another plugin, dependencies are also allowed to be declared. Like the eclipse engine, activation of plugins occurs the first time a class is used within the plugin's classpath, OR a plugin can be activated after it is loaded.
    What I need help with is testing, working on examples to provide with the engine project, and feedback/suggestions before we release the M1 build. I am asking for those that are interested in this type of work to volunteer to help where applicable and possible. I want to provide a solid plugin engine to the java community, one that is easy to use, works well, and is pretty effecient in terms of resource usage and performance.
    Of particular interest to me right at the moment is dealing with multiple versions. As I see it, the engine will be used within an application and as such plugins would be distributed with a specific application version. The plugin version itself is more of a notification as to what version a plugin is, although I imagine it will help when updating at runtime as well.
    Just a few other details of the engine. It handles (or will soon) dynamic load, unload and reload of plugins at runtime. Plugins can be distributed in an archive file format, we call .par (Plugin ARchive), with additional plugin filename extensions configurable at runtime. The plugins can be developed and deployed in an expanded directory format as they are in Eclipse as well, or in the archive format. In the archive format they do not need to be unzipped when deployed, and they can contain embeded jar/zip libraries. The engine handles finding and creating classes directly out of the .par file at runtime.
    Multiple locations to find plugins are configurable before the engine starts, and even after it starts more could be added to allow additional locations to find plugins. URLs are supported, and soon the HTTP protocol will be supported so that plugins can be downloaded and installed at runtime.
    The project can be found at www.sourceforge.net/projects/genpluginengine. If you would like to get involved and help out, please sign up on the dev mail list and send an email to introduce yourself to the rest of the members on the list.
    I'll also add that I am working on a Swing UI Framework built entirely from plugins. It provides a ready-to-launce UI application that developers can simply add their plugins to, extending various extension points of the framework to have menu items, toolbar buttons, status bar access, help and preferences dialog additions, file i/o choosers, tons of open-source components ready to use (or extend to add on to), and like Eclipse, hopefully... draggable window frames that can be dropped on any other frame to form a tabbed frame of windows. Some of this is a ways off, some is getting there now. Presently you can add menu items that do allow plugin activation when first clicked, so plugins can be loaded but not activated until needed. The Preference dialog works but is not completed, and a plugin that adds a plugin control panel to view all loaded plugins, activate them, load/unload/reload, view extension points, extensions, dependencies, etc is partially completed. The point is, to allow a ready to run UI framework in Swing with an easy path for developers to quickly build applications with. If you are interested in this, when you join the mail list and introduce yourself, indicate that you are interested in this as well, as we need help with plugin development for it and would appreciate more help here too.
    Look forward to some replies.

    Might I suggest setting up a project at a known project-site? I've seen your progress and questions posted here from time to time, but one of the drawbacks is that you have to fill each post with the entirity of your vision to explain what you're doing. That's a lot of text to read - and most folks will skip right over it.
    On the other hand, a well-crafted, good-looking project web-site, with appropriate links and docs and vision statements, diagrams, etc. will have more likelyhood of attracting volunteers. java.net and sourceforge.net are likely spots to set up shop. In addition, you get CVS and bug-tracking systems, which can be quite valuable in such a large-scale project where there are lots of pieces.

  • Need help with a simple process with FTP Adapter and File Adapter

    I am trying out a simple BPEL process that gets a file in opaque mode from a FTP server using a FTP adapter and writes it to the local file system using a File Adapter. However, the file written is always empty (zero bytes). I then tried out the FTPDebatching sample using the same FTP server JNDI name and this work fine surprisingly. I also verified by looking at the FTP server logs that my process actually does hit the FTP server and seems to list the files based on the filtering condition - but it does not issue any GET or RETR commands to actually get the files. I am suspecting that the problem could be in the Receive, Assign or Invoke activities, but I am not able identify what it is.
    I can provide additional info such as the contents of my bpel and wsdl files if needed.
    Would appreciate if someone can help me with this at the earliest.
    Thanks
    Jay

    persiandude wrote:
    Topic: Need help with if, else, and which statements and loops.
    How would I display 60 < temp. <= 85 in java
    System.out.println("60 < temp. <= 85 in java");
    another question is how do I ask a question like want to try again (y/n) after a output and asking that everytime I type in yes after a output and terminate when saying No.Sun's [basic Java tutorial|http://java.sun.com/docs/books/tutorial/]
    Sun's [New To Java Center|http://java.sun.com/learning/new2java/index.html].Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    [http://javaalmanac.com|http://javaalmanac.com]. A couple dozen code examples that supplement [The Java Developers Almanac|http://www.amazon.com/exec/obidos/tg/detail/-/0201752808?v=glance].
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's [Thinking in Java|http://mindview.net/Books/DownloadSites] (Available online.)
    Joshua Bloch's [Effective Java|http://www.amazon.com/Effective-Java-2nd-Joshua-Bloch/dp/0321356683/ref=pd_bbs_1?ie=UTF8&s=books&qid=1214349768&sr=8-1]
    Bert Bates and Kathy Sierra's [Head First Java|http://www.amazon.com/exec/obidos/tg/detail/-/0596004656?v=glance].
    James Gosling's [The Java Programming Language|http://www.bookpool.com/sm/0321349806].

  • Need help with writing a rule

    Need help with some rules. I want to book a number to a specific Entity at a Specific Custom 4 only. I don't want this formula to work at all C4 levels. How can this be done?
    for example if Entity is "XBM1123" and we use C4 for tracking and the tracking level I want to book it to is IMPORT, how can this be done for a specific account 4400221
    I have my formula as
    If pov_value = "<Entity Currency>" or pov_value = "<Entity Curr Adjs>" Then
    If HS.Entity.Member = "XBM1123" or HS.Custom4.Member = "IMPORT" then
    HS.EXP "A#4400221= A#4521111 + A#3526644 + A#635210"
    End If
    End if
    this did not work. I got hte following error
    Calculate started.<BR>Error executing VBScript Microsoft VBScript runtime
    error, Line 259:Object doesn't support this property or method:
    'HS.Custom4.Member'.<BR>Calculate finished.<BR>Error executing
    VBScript %0.
    I then changed it to the below and it still did not work
    If pov_value = "<Entity Currency>" or pov_value = "<Entity Curr Adjs>" Then
    If HS.Entity.Member = "XBM1123" then
    HS.EXP "A#4400221.C4#IMPORT= A#4521111 + A#3526644 + A#635210"
    End If
    End if
    error
    Invalid Custom1 member
    specified for this function.
    Invalid Destination specified for this function:
    A#4400221.C4#IMPORT.

    You are close.
    Try:
    If pov_value = "<Entity Currency>" or pov_value = "<Entity Curr Adjs>" Then
        If HS.Entity.Member = "XBM1123" then
           HS.EXP "A#4400221.C4#IMPORT= A#4521111.C4#IMPORT + A#3526644.C4#IMPORT + A#635210.C4#IMPORT"
        End If
    End if
    or replace IMPORT with with Top_C4 or what ever member you need to copy to C4#IMPORT.
    Rule of thumb, to be on the safe side and for most simple calcs, is if you mention a dimension on the left side, you need to define it on the right side as well.

  • Hi! I am newbie to Reports need help with check boxes

    Hi! I am newbie to Reports need help with check boxes. I am try-in to make a new check boxes that will validate in runtime. I have created two frames and one frame is dummy and other frame has big X line on it with conditions. Is this a right way to create check box! Please help thanks!

    and one frame is dummy and other frame has big X
    line on it with conditions. Is this a right way to
    create check box! Please help thanks!Instead of creating a frame for X, you can create Ractangle and place X in it. Rest is fine.

  • Need help with a simple program (should be simple anyway)

    I'm (starting to begin) writing a nice simple program that should be easy however I'm stuck on how to make the "New" button in the file menu clear all the fields. Any help? I'll attach the code below.
    ====================================================
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Message extends JFrame implements ActionListener {
         public void actionPerformed(ActionEvent evt) {
         text1.setText(" ");
         text2.setText("RE: ");
         text3.setText(" ");
         public Message() {
         super("Write a Message - by Kieran Hannigan");
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         setSize(370,270);
         FlowLayout flo = new FlowLayout(FlowLayout.RIGHT);
         setLayout(flo);
         //Make the bar
         JMenuBar bar = new JMenuBar();
         //Make "File" on Menu
         JMenu File = new JMenu("File");
         JMenuItem f1 = new JMenuItem("New");f1.addActionListener(this);
         JMenuItem f2 = new JMenuItem("Open");
         JMenuItem f3 = new JMenuItem("Save");
         JMenuItem f4 = new JMenuItem("Save As");
         JMenuItem f5 = new JMenuItem("Exit");
         File.add(f1);
         File.add(f2);
         File.add(f3);
         File.add(f4);
         File.add(f5);
         bar.add(File);
         //Make "Edit" on menu
         JMenu Edit = new JMenu("Edit");
         JMenuItem e1 = new JMenuItem("Cut");
         JMenuItem e2 = new JMenuItem("Paste");
         JMenuItem e3 = new JMenuItem("Copy");
         JMenuItem e4 = new JMenuItem("Repeat");
         JMenuItem e5 = new JMenuItem("Undo");
         Edit.add(e5);
         Edit.add(e4);
         Edit.add(e1);
         Edit.add(e3);
         Edit.add(e2);
         bar.add(Edit);
         //Make "View" on menu
         JMenu View = new JMenu("View");
         JMenuItem v1 = new JMenuItem("Bold");
         JMenuItem v2 = new JMenuItem("Italic");
         JMenuItem v3 = new JMenuItem("Normal");
         JMenuItem v4 = new JMenuItem("Bold-Italic");
         View.add(v1);
         View.add(v2);
         View.add(v3);
         View.addSeparator();
         View.add(v4);
         bar.add(View);
         //Make "Help" on menu
         JMenu Help = new JMenu("Help");
         JMenuItem h1 = new JMenuItem("Help Online");
         JMenuItem h2 = new JMenuItem("E-mail Programmer");
         Help.add(h1);
         Help.add(h2);
         bar.add(Help);
         setJMenuBar(bar);
         //Make Contents of window.
         //Make "Subject" text field
         JPanel row2 = new JPanel();
         JLabel sublabel = new JLabel("Subject:");
         row2.add(sublabel);
         JTextField text2 = new JTextField("RE:",24);
         row2.add(text2);
         //Make "To" text field
         JPanel row1 = new JPanel();
         JLabel tolabel = new JLabel("To:");
         row1.add(tolabel);
         JTextField text1 = new JTextField(24);
         row1.add(text1);
         //Make "Message" text area
         JPanel row3 = new JPanel();
         JLabel Meslabel = new JLabel("Message:");
         row3.add(Meslabel);
         JTextArea text3 = new JTextArea(6,22);
         messagearea.setLineWrap(true);
         messagearea.setWrapStyleWord(true);
         JScrollPane scroll = new JScrollPane(text3,
                                  JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                  JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
         //SpaceLine
         JPanel spaceline = new JPanel();
         JLabel spacer = new JLabel(" ");
         spaceline.add(spacer);
         row3.add(scroll);
         add(row1);
         add(row2);
         add(spaceline);
         add(spaceline);
         add(row3);
         setVisible(true);
         public static void main(String[] arguments) {
         Message Message = new Message();
    }

    persiandude wrote:
    Topic: Need help with if, else, and which statements and loops.
    How would I display 60 < temp. <= 85 in java
    System.out.println("60 < temp. <= 85 in java");
    another question is how do I ask a question like want to try again (y/n) after a output and asking that everytime I type in yes after a output and terminate when saying No.Sun's [basic Java tutorial|http://java.sun.com/docs/books/tutorial/]
    Sun's [New To Java Center|http://java.sun.com/learning/new2java/index.html].Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    [http://javaalmanac.com|http://javaalmanac.com]. A couple dozen code examples that supplement [The Java Developers Almanac|http://www.amazon.com/exec/obidos/tg/detail/-/0201752808?v=glance].
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's [Thinking in Java|http://mindview.net/Books/DownloadSites] (Available online.)
    Joshua Bloch's [Effective Java|http://www.amazon.com/Effective-Java-2nd-Joshua-Bloch/dp/0321356683/ref=pd_bbs_1?ie=UTF8&s=books&qid=1214349768&sr=8-1]
    Bert Bates and Kathy Sierra's [Head First Java|http://www.amazon.com/exec/obidos/tg/detail/-/0596004656?v=glance].
    James Gosling's [The Java Programming Language|http://www.bookpool.com/sm/0321349806].

  • Problem with Runtime.exec()

    Hi,
    I'm having a problem with Runtime.exec() . I have a batch file with debug option to FTP the desktop file to mainframe. When I executed this in Windows it's shows me the responce from the server (like ' Transfer Completed' ) for my FTP commands. But when I launch this through java it's only shows the errors not the normal responces from the server. I need this responses to confirm the proper transfer of file.
    My Java Code:
    String strCommand = "cmd.exe /c " + outdirectory + batchfilename;
    boolean bWait = true;
    Runtime r = Runtime.getRuntime();
    Process pr = r.exec(strCommand);
    BufferedInputStream bis =new BufferedInputStream(pr.getInputStream ());
    int c=0;
    /** Outlet for IO for the process **/
    while (c!=-1) {
    c=bis.read();
    /**Now wait for the process to get finished **/
    if(bWait == true){
    pr.waitFor();
    pr.destroy();
    My Batch file is :
    FTP -n -d -s:C:\IT2.cmd > C:\tIT2.log
    EXIT
    Thanks
    Sathiesh

    Ahh, you are redirecting the standard out from the ftp command to a file, therefore no output is sendt back to your java code,
    you have to redirect the stderr stream, not the stdout stream in your batch file;
    FTP -n -d -s:C:\IT2.cmd 2> C:\tIT2.log(notice the "2>" instead of ">")
    Now your batch file should direct the error stream to the log, and the standard output back to the java program.
    (I'm used to UNIX streams, not NT, but the "2>" redirection should work on NT also I guess)

  • Need Help with .nnlp File.............A.S.A.P.

    I'm having a problem also with my JNLP file. I have downloaded the program onto one computer and that computer is using j2re1.4.2_04
    The other computers I believe are all running j2re 1.4.2_05
    I'm not sure if that's make a difference, but on the computer with j2re 1.4.2_05 when going to the site where the .jnlp file is located, the application comes up and says Starting Application. After it gets to that screen it just stays there. I really need help with this as soon as possible.
    Here is my .jnlp file listed below:
    <?xml version="1.0" encoding="utf-8"?>
    <jnlp
      spec="1.0+"
      codebase="http://www.appliedsolutions.com/placewiz"
      href="Placewiz.jnlp">
      <information>
        <title>Placement Wizard 4.0</title>
        <vendor>Applied Solutions, Inc.</vendor>
        <homepage href="index.html"/>
        <description>Placement Wizard 4.0</description>
        <description kind="short">Short description goes here.</description>
        <offline-allowed/>
      </information>
      <resources>
        <j2se version="1.4+"/>
        <j2se version="1.3+"/>
         <j2se version="1.5+"/>
        <jar href="Placewiz.jar"/>
      </resources>
      <security>
          <all-permissions/>
      </security>
      <application-desc main-class="com/asisoftware/placewiz/loader/Exec">
    </jnlp>

    This was due to a change in 1.4.2_05
    the main class attribute
    main-class="com/asisoftware/placewiz/loader/Exec">is wrong - it should be:
    main-class="com.asisoftware.placewiz.loader.Exec">this didnt seem to mater before 1.4.2_05, but some change in java since then caused this bad class specification to stop loading.
    /Andy

Maybe you are looking for

  • [10.5] ssh starts X11.app

    Good morning, Strange behaviour on a system with a new installation of leopard: every time I try to connect to any remote host by ssh (under Terminal.app), X11.app starts. I'm still trying to find why, and already checked the .bashrc, .profile, etc.

  • Swf on window mobile 2003

    Hi! I have to do a flash application that runs on window mobile 2003. It uses ExternalInterface.addCallback method.. I have some problems with it on my pc because it doesn't work but recently I learned that it could due to security rules on flash pla

  • Is it recommendable to use adobe flash player

    Would it be advisable to use adobe flash v.11 on mbp for viewing or not?

  • Photoshop cs5, Opening Tiff into Raw. Some open and others don't.

    I have installed cs5 onto my Windows Envy laptop. I want to open my tiff into raw. I can do that with some of the tiff files and others I cannot, the option is greyed out. Then the pic. next to it works and the one after does not, so forth and so on.

  • VPN in a VMWare XP session from MBP

    While waiting to order my MBP, I was wondering if I ran a VPN (from my company) in XP using VMWare, could the mac side use this VPN connection as well (Like a shared internet connection or passthru) or is it limited to just the XP applications. If no