Click to See Complete Forum and Search --> : Getting Windows Directory


Coder
September 30th, 1999, 10:51 AM
Hello I would like to know if anyone knows how to get the Windows Directory in Java.
I would appreciate it if u can send me some code that dows this.
I am hard coding it for now and I really do not wnat to do that. Thanks alot.

CODER '99

"I think I am - therefore I am"

poochi
September 30th, 1999, 01:05 PM
What do you mean by "Windows Directory in Java." ?

Coder
September 30th, 1999, 01:17 PM
What I mean by Windows Directory is that it could tell me the harddrive as well as windows dir
e.g if the use is runnig Windoews it returns
C:\windows or
and NT it returns C:\Winnt
That is what I mean by Getting the Windows Directory

so how can I do this in Java

"I think I am - therefore I am"

meherss
September 30th, 1999, 01:19 PM
You can query the system environment for SystemRoot will give you the Windows directory.



Meher

meherss
September 30th, 1999, 01:35 PM
I'm sorry about the earlier reply.
You can not query the system environment variables directly so you have to do in another way.
You have to have a property file ( like win.ini ) to your application and feed this info in that file before you run the application. In your application you have to read the property file and pick the required info. and do it accordingly.
Basically property file will be a key and value pair that you can create using java.util.Properties

Hope this helps ...

Meher