Call exe file with parameters in JAVA

Hello everyone!

In a DOS-based console,if I want to encypt a file "m",I just use an exe file named "crypt" followed by the file name which is going to be encrypt.The command is: crypt m.Then press Enter,that is all.

How can I do this in java? I know how to call an exe file in java,but how can I pass a parameters like file name to the exe file?

Thanks very much!

[388 byte] By [truehhha] at [2007-10-2 20:17:32]
# 1
:)I sorted it out.The solution is very simple:sample:String[] commands={"c:\\crypt.exe","c:\\counted.lic"};Runtime.getRuntime().exec(commands);
truehhha at 2007-7-13 23:00:00 > top of Java-index,Other Topics,Fresh Tools...
# 2
you must use absolute path, so, if the m file is located in c:\encrypt\m.file you must call : crypt "c:\encrypt\m.file"And the path of crypt.exe must be the same with the java runtime path, either you must change the Runtime's environtment.
mimi_tan1985a at 2007-7-13 23:00:00 > top of Java-index,Other Topics,Fresh Tools...
# 3
thank u very much ,its very useful to me
chinchua at 2007-7-13 23:00:00 > top of Java-index,Other Topics,Fresh Tools...