problem opening a file from Runtime.exec()

hi

I'm trying to open a certificate (.cer), from my java code.

If I go on a windows command, and I type only the name of my certificate ( f:\certificate.cer), it is opened.

If I use the java code

Process process = Runtime.getRuntime().exec("F:\\certificate.cer");

it doesn't work:

java.io.IOException: CreateProcess: "f:\oid.crt" error=193

anybody knows what I can do to make it work?

Thanks in advance

Philippe

[500 byte] By [phsansa] at [2007-10-2 18:00:07]
# 1
the error for this line of code is of course java.io.IOException: CreateProcess: "f:\certificate.cer" error=193
phsansa at 2007-7-13 19:19:06 > top of Java-index,Desktop,Runtime Environment...
# 2

For windows you need to used the cmd.exe to do what you want.

i.e. cmd /c f:\certificate.cer

Process process = Runtime.getRuntime().exec("cmd.exe /c F:\\certificate.cer");

At a command prompt, for more help on cmd.exe type: cmd /?

Also for help on a related command, type: start /?

Also read http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

Caffeine0001a at 2007-7-13 19:19:06 > top of Java-index,Desktop,Runtime Environment...
# 3
start certificate.cer
BIJ001a at 2007-7-13 19:19:06 > top of Java-index,Desktop,Runtime Environment...