This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How do I read NT Environment variables? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How do I read NT Environment variables?" Watch "How do I read NT Environment variables?" New topic
Author

How do I read NT Environment variables?

Matt Senecal
Ranch Hand

Joined: Dec 01, 2000
Posts: 255
I need to get the value of the NT environment variable "TEMP", and I notice that getenv() is conveniently deprecated. Is there another way to do this?


There's nothing more dangerous than a resourceful idiot. ---Dilbert
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
From the Java Doc's on Deprecation:
java.lang.System.getenv(String)
The preferred way to extract system-dependent information is the system properties of the java.lang.System.getProperty methods and the corresponding getTypeName methods of the Boolean, Integer, and Long primitive types. For example:
<pre>
String classPath = System.getProperty("java.class.path",".");
if (Boolean.getBoolean("myapp.exper.mode"))
{
enableExpertCommands();
}
</pre>
Hope this helps


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
 
Have you checked out Aspose?
 
subject: How do I read NT Environment variables?
 
jQuery in Action, 3rd edition