IgnoreCase filename

File f =new File("f:/myfile.pps");

if(f.exists()){

Runtime.getRuntime().exec(new String[]{"cmd /c start","f:/myfile.pps"});

}

how can i make the code such that it will also execute the file although the filenamemyfile.pps is saved in capital letters?

thank you.

[588 byte] By [sarah007a] at [2007-11-27 11:22:25]
# 1

I'm not sure if this is possible. Can you use a JFileChooser to allow user to select the file, instead of hard coding it?

floundera at 2007-7-29 14:54:47 > top of Java-index,Java Essentials,New To Java...
# 2

> File f =new File("f:/myfile.pps");

> if(f.exists()) {

> Runtime.getRuntime().exec(new String[] {"cmd /c start", "f:/myfile.pps"});

> }

>

> how can i make the code such that it will

> also execute the file although the filename

> myfile.pps is saved in capital letters?

> thank you.

It depends what OS you're using: Windows doesn't care if there's myfile.pps, MYfile.PpS, myfile.ppS, ... on F:\. They are all the same. On *nix, they're all different.

prometheuzza at 2007-7-29 14:54:47 > top of Java-index,Java Essentials,New To Java...
# 3

hi, thanks for the guide, i'm using Windows platform and the file is able to execute though the filename is caps lock, thank you :)

sarah007a at 2007-7-29 14:54:47 > top of Java-index,Java Essentials,New To Java...
# 4

File name is OS dependent

Prem_Sa at 2007-7-29 14:54:47 > top of Java-index,Java Essentials,New To Java...
# 5

> File name is OS dependent

What does that even mean?

georgemca at 2007-7-29 14:54:47 > top of Java-index,Java Essentials,New To Java...