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(Un known Source)
at com.util.createLog2.calcul ate(create Log2.java: 41)
at com.Main.main(Main.java:39 0)
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(Un
at com.util.createLog2.calcul
at com.Main.main(Main.java:39
looks like you need to upgrade java: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4199068
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.
BTW that is still Windows-specific code. Move the "windir" to a properties-file and read from there.
ASKER
No,
System.getProperty ( "windir" )
is giving null
System.getProperty ( "windir" )
is giving null
ASKER
I am using JRE 1.4.2_03-b02
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
it wont work in 1.4.
you can do like this...
https://www.experts-exchange.com/questions/21137235/Windows-System32-folder.html
you can do like this...
https://www.experts-exchange.com/questions/21137235/Windows-System32-folder.html
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The method i mentioned is more tiresome than that, but less vulnerable. Let me know if you need to run on <= Win98
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER