open file in a folder

if i have a powerpoint filemyfile.pps and i saved in a folder of any folder name in the f:// directory, how do i execute the file? Using this following codeRuntime.getRuntime().exec(new String[]{"cmd /c start","f:/myfile.pps"});

thanks

[393 byte] By [sarah007a] at [2007-11-27 8:49:51]
# 1
Maybe using \\ as a path divider would help here. I don't know how Windows reacts on the slash.(Assuming that you actually have a problem, which isn't clear from your post. Next time, it might be a good idea to talk about any errors and to ask a question.)
CeciNEstPasUnProgrammeura at 2007-7-12 20:59:45 > top of Java-index,Java Essentials,Java Programming...
# 2

> Maybe using \\ as a path divider would help here. I

> don't know how Windows reacts on the slash.

> ...

No need: Windows handles the / as a path divider just fine.

@OP: Are you the same as the person in this thread: http://forum.java.sun.com/thread.jspa?forumID=54&threadID=5187943 ?

prometheuzza at 2007-7-12 20:59:45 > top of Java-index,Java Essentials,Java Programming...
# 3

> ...

> @OP: Are you the same as the person in this thread:

> ...

Never mind you must be.

All you need is in the File class:

http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html

and especially this method:

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

which will return an array of File objects which represent the file and directory listing of a particular folder (use it on you F:/ folder!). Iterate over that array and if you encounter a directory (use File's isDirectory() method) you can inspect that directory for the existence of your pps file.

prometheuzza at 2007-7-12 20:59:45 > top of Java-index,Java Essentials,Java Programming...
# 4
Definitely not. Don't know who is him/her. Can't view the thread also.Anyway thanks.
sarah007a at 2007-7-12 20:59:45 > top of Java-index,Java Essentials,Java Programming...
# 5
> ... Can't view the thread also.You should have copied it without the question mark, of course. Try again: http://forum.java.sun.com/thread.jspa?forumID=54&threadID=5187943> Anyway thanks.You're welcome.
prometheuzza at 2007-7-12 20:59:45 > top of Java-index,Java Essentials,Java Programming...
# 6
I viewed the thread but not the one i know.
sarah007a at 2007-7-12 20:59:45 > top of Java-index,Java Essentials,Java Programming...