Need informatin to get OS directory

Hiz

I want to get OS root directory since program files i.e C:\Program Files

i want to get C:\Program Files this path please any one can help me

reason to getting this path is in spanish OS path is C:\Archivos de programa and i want to access IEXPlorer.exe

so kindly respond me as soon as possible

thankin in anticipation

Muhamma Abid

[379 byte] By [Chaudhrya] at [2007-11-26 23:51:15]
# 1
Why do you want to access that file? Don't want to use IE on my machine. You should instead launch the default browser. Kaj
kajbja at 2007-7-11 15:29:47 > top of Java-index,Java Essentials,New To Java...
# 2
See the browse method: http://java.sun.com/javase/6/docs/api/java/awt/Desktop.htmlKaj
kajbja at 2007-7-11 15:29:47 > top of Java-index,Java Essentials,New To Java...
# 3
What do you exactly want? Does the environment variable ProgramFiles help you?
BIJ001a at 2007-7-11 15:29:47 > top of Java-index,Java Essentials,New To Java...
# 4

Yes i have to access program file path

My code is there it will work on two system that on English or Spanish

if i get exact Path till Program Files than my program will run on any OS system like on German Chinese etc

if someone know plz help me my code is below:

try

{

String strUserHome = System.getProperty("user.home");

String strProgram = strUserHome.substring(0, 2);

String strProgramCommand = strProgram

+ "/Program Files/Internet Explorer/IEXPLORE.EXE";

String strHelpPage = System.getProperty("user.dir")+"/bin/help.html";

System.out.println("Operating System Architecture : = " + System.getProperty("os.arch"));

System.out.println("Operating System Architecture : = " + System.getProperty("java.ext.dirs"));

try{

Runtime.getRuntime().exec(

new String[] { strProgramCommand, strHelpPage });

}catch(IOException ioexp){

System.out.println("'Program File' name in this OS is 'Archivos de programa'");

strProgramCommand = strProgram

+ "/Archivos de programa/Internet Explorer/IEXPLORE.EXE";

Runtime.getRuntime().exec(

new String[] { strProgramCommand, strHelpPage });

}

}

catch (Exception objException)

{

objException.printStackTrace();

}

Chaudhrya at 2007-7-11 15:29:47 > top of Java-index,Java Essentials,New To Java...
# 5

> Yes i have to access program file path

> My code is there it will work on two system that on

> English or Spanish

No, it will fail on mine. I have an English OS, but I have installed the applications in the folder "programs".

And as I said, the user might not even use the browser that you are trying to launch. I never use IE I do always use Firefox. Read my previous reply about the Desktop class, and the browse method.

Kaj

kajbja at 2007-7-11 15:29:47 > top of Java-index,Java Essentials,New To Java...
# 6
Well thanks KalJI m using 1.4 jdkdont have Desktop class any way thanks
Chaudhrya at 2007-7-11 15:29:47 > top of Java-index,Java Essentials,New To Java...
# 7

Use the rundll32.exe and the FileProtocolHandler and url.dll in a call to runtime exec, and add the url you want to open.

Runtime.getRuntime().exec("cmd /c rundll32.exe url.dll,FileProtocolHandler http://www.google.com");

Message was edited by:

SomeoneElse

SomeoneElsea at 2007-7-11 15:29:47 > top of Java-index,Java Essentials,New To Java...
# 8
> Well thanks KalJ> I m using 1.4 jdk> dont have Desktop class > any way thanksYou can use JDIC. I think it supports JDK 1.4Kaj
kajbja at 2007-7-11 15:29:47 > top of Java-index,Java Essentials,New To Java...
# 9
Thanks its workingRuntime.getRuntime().exec("cmd /c rundll32.exe url.dll,FileProtocolHandler http://www.google.com")can u tell me the descripption that we r using like i want to know what is the purpose of '/c'
Chaudhrya at 2007-7-11 15:29:47 > top of Java-index,Java Essentials,New To Java...