pechkin: (Default)
pechkin ([personal profile] pechkin) wrote2004-02-11 01:17 am

(no subject)



Вот облом! Хочу сделать

protected static String[] dirArgs={"/s", "/-c", ""};
public void getListRecursive(DirectoryData dir, InfoComparator comparator) throws Exception
{
dirArgs[2]=root+dir.getPathName();
BufferedReader sysin=new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("dir", dirArgs).getInputStream()));
}


а получаю

Exception: CreateProcess: dir error=2
java.io.IOException: CreateProcess: dir error=2
at java.lang.Win32Process.create(Native Method)
at java.lang.Win32Process.(Win32Process.java:66)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Runtime.java:551)
at java.lang.Runtime.exec(Runtime.java:418)
at java.lang.Runtime.exec(Runtime.java:361)
at com.redeyes.net.sitesync.fs.FileSystemFileWindows.getListRecursive(FileSystemFileWindows.java:30)


Убираю аргументы, оставляю один dir – эффект устойчиво сохраняется.

Что бы это могло быть?

[identity profile] bigturtle.livejournal.com 2004-02-10 05:32 pm (UTC)(link)
winerror.h:
#define ERROR_FILE_NOT_FOUND 2L

Нету у тебя dir.exe, нету...
А вот "cmd.exe /c dir" - есть.

Re:

[identity profile] pechkin.livejournal.com 2004-02-12 01:24 am (UTC)(link)
Oj, blja...

Vot do 4ego linux dovodit.

Tuk-tuk. Djatel ja.

Re:

[identity profile] duke-of-liss.livejournal.com 2004-02-12 11:49 am (UTC)(link)
И ещё надо полный путь к cmd.exe указать. Runtime.exec переменную PATH не юзает.

[identity profile] xfyre.livejournal.com 2004-02-10 09:24 pm (UTC)(link)
а чем, собственно,

http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#list()

плохо?

Re:

[identity profile] pechkin.livejournal.com 2004-02-12 01:25 am (UTC)(link)
Xotel posmotret', 4to bystree na bol'wix objemax.