Windows environment variables
How do I get and set Windows environment variables from within a Java app.?
For example, if I set "TEMP=C:\TEMP" in the system properties, how do I
Re: Windows environment variables
First of all, don't use environment variables to pass information to Java
programs. The Java way to pass small amounts of constant information into a
program is to use a properties file; see the class java.util.Properties.
However, if you need to pass an existing environment variable, you use
the -D parameter on the "java" command, like this in Windows:
java -DTEMP=%TEMP% yourClass
and then in the Java program you get the TEMP system property, like this:
String temp = System.getProperty("TEMP");
"Shawn" <email@example.com> wrote in message
> How do I get and set Windows environment variables from within a Java
> For example, if I set "TEMP=C:\TEMP" in the system properties, how do I
> retrieve "C:\TEMP"?
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL