Link to home
Start Free TrialLog in
Avatar of sree032397
sree032397

asked on

Problem with System.getProperties(windir)

I am using String fileName = System.getenv("windir")
It is giving :

Exception in thread "main" java.lang.Error: getenv no longer supported, use prop
erties and -D instead: windir
        at java.lang.System.getenv(Unknown Source)
        at com.util.createLog2.calculate(createLog2.java:41)
        at com.Main.main(Main.java:390)
Avatar of sree032397
sree032397

ASKER

Sorry System.getenv("windir")
Avatar of Mayank S
System.getProperty ( "windir" ) ;
I mean: String fileName = System.getProperty ( "windir" ) ;

BTW that is still Windows-specific code. Move the "windir" to a properties-file and read from there.
No,
System.getProperty ( "windir" )
is giving null
I am using JRE 1.4.2_03-b02
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The method i mentioned is more tiresome than that, but less vulnerable. Let me know if you need to run on <= Win98
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial