Java, wywolanie exe z linii komend, Runtime

0

Cześć,

dodalem sobie curl.exe do sciezki pod windowsem (jak wpisze w cmd: curl, to z kazdego katalogu zadziala)

Teraz z poziomu javy probuje tak:

try {
            String command = "cmd curl.exe --help";
            Process p = Runtime.getRuntime().exec(command);
            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();
        }

i to zamiast zwrocic liste z helpa curla, to wypisuje tylko:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

(samo jakby wlaczenie cmd)

macie pomysly jak to naprawic ?
dzieki

0

zrobilem tak i dziala gdy dsobie odpale maina w klasie:

      Runtime p = Runtime.getRuntime();
            String[] commands = new String[3];
            commands[0] = "cmd";
            commands[1] = "/c";
            commands[2] = "\\cos\\cos\\curl.exe ......" ;
            Process x = p.exec(commands);

            BufferedReader in = new BufferedReader(
                    new InputStreamReader(x.getInputStream()));
            String line = null;
            while ((line = in.readLine()) != null) {
                System.out.println(line);
            }

jednak jak juz zbucuje wara z aplikacja i wrzuce na tomcata, to line ma nulla (wiec polecenie sie nie wykonalo)

jak moge to zrobic, zeby w apliakcji webowej to tak dzialalo ?

dzieki

1 użytkowników online, w tym zalogowanych: 0, gości: 1