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)
Java

Avatar of undefined
Last Comment
Mick Barry

8/22/2022 - Mon
sree032397

ASKER
Sorry System.getenv("windir")
Ajay-Singh

looks like you need to upgrade java: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4199068
Mayank S

System.getProperty ( "windir" ) ;
Your help has saved me hundreds of hours of internet surfing.
fblack61
Mayank S

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.
sree032397

ASKER
No,
System.getProperty ( "windir" )
is giving null
sree032397

ASKER
I am using JRE 1.4.2_03-b02
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER CERTIFIED SOLUTION
CEHJ

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
mbvvsatish

SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
CEHJ

The method i mentioned is more tiresome than that, but less vulnerable. Let me know if you need to run on <= Win98
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.