Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Java Miscellaneous Get Environment Variables in Java Tutorial

In Java 1.5, Sun had decided to undeprecate the getEnv() method that provides the functionality to get the value of an enviroment variable. In addition, Sun has added a new method that allows you to discover all of the enviroment variables that are define

Tutorial Details:

Get Environment Variables in Java

In Java 1.5, Sun had decided to "undeprecate" the getEnv() method that provides the functionality to get the value of an environment variable. In addition, Sun has added a new method that allows you to discover all of the environment variables that are defined. This tutorial walks you through using both the old and new methods.

To get the value of a single environment variable, you simply need to call the getEnv(" environment variable ") method providing the environment variable name that you want to evaluate. The following is a simple example:
String variable = System.getenv("WINDIR");
System.out.println(variable);

In Java 1.5, a new method was introduced to allow you to discover all of the environment variables defined in the system. The following example uses the new method to print all of the environment variables and their values:
Map variables = System.getenv();


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Java Miscellaneous Get Environment Variables in Java Tutorial

View Tutorial:
Java Miscellaneous Get Environment Variables in Java Tutorial

Related Tutorials:

Saving and retrieving objects with Java
Saving and retrieving objects with Java
 
Programming Java threads in the real world, Part 1 - JavaWorld - September 1998
Programming Java threads in the real world, Part 1 - JavaWorld - September 1998
 
Programming Java threads in the real world, Part 7 - JavaWorld - April 1999
Programming Java threads in the real world, Part 7 - JavaWorld - April 1999
 
A promise of easier embedded-systems networking - JavaWorld November 1999
A promise of easier embedded-systems networking - JavaWorld November 1999
 
Use Microsoft's Internet Information Server as a Java servlet engine - JavaWorld June 2000
Use Microsoft's Internet Information Server as a Java servlet engine - JavaWorld June 2000
 
Tcl your Java apps - JavaWorld March 2001
Tcl your Java apps - JavaWorld March 2001
 
The Java Web Services Tutorial
This tutorial is a beginner\'s guide to developing Web services and Web applications using the Java Web Services Developer Pack (Java WSDP).
 
Flexible User and Environment Ant Configuration
Flexible User and Environment Ant Configuration The de facto standard for building, packaging, and deploying Java applications is Apache Ant. Small differences in developers\' environments or preferences may cause problems with some Ant tasks that invo
 
Jython
Get to know Jython, in this first article in a new series introducing alternate languages for the Java Runtime Environment, alt.lang.jre. Jython is an implementation of the popular scripting language Python, but running on a JVM. For Python developers Jyt
 
When tears bring you back your beloved method...
Accessing platform-specific information hasn't always been easy. While you could certainly create processes with Runtime.exec(), dealing with differences across platforms to build parameter sets often led to headaches. In addition, the getenv() method of
 
The JDBC RowSet Implementations Tutorial
In "The JDBC RowSet Implementations Tutorial," you will look at how to use the standard JDBC RowSet implementations specified in JSR-114.
 
Java Beans, Part 1 Introducing Java Beans
The basic idea of the Beans tutorial is to get you to the point where you can quickly create beans. You may want to write new beans from scratch, or you may want to take existing components, applets, or other classes and turn them into beans.
 
Servlet Essentials
This document explains the concepts of Java Servlets and provides a step-by-step tutorial for writing HTTP Servlets with complete source code for the example Servlets. The tutorial and the other chapters cover all facets of Servlet programming from a ...
 
The JavaTM Web Services Tutorial
A beginner's guide to developing Web services and Web applications on the Java Web Services Developer Pack
 
JSP Tutorial
This Tutorial is for beginners in the Java Server Pages Technology
 
JavaServer Pages Technology - Documentation
Sun's tutorial for Java Server Pages that provide a good introduction to design web pages with JSP.
 
JDBC RowSet Implementations Tutorial (PDF)
This tutorial explains how to use the standard JDBC RowSet implementations that are provided as part of J2SE 5.0. Get up to speed with each RowSet definition and benefit from improved scalability and robustness.
 
Understanding Network Class Loaders Class loaders
One of the cornerstones of Java dynamics, determine when and how classes can be added to a running Java environment.
 
Core Java Interview Questions!
Core Java Interview Questions! Core Java Interview Questions Question: What is transient variable? Answer: Transient variable can't be serialize. For example if a variable is declared as transient in a Serializable class and the class is written
 
Installing Sun JDK on Linux
Installing Sun JDK on Linux Installing Sun JDK on Linux (Fedora Core 3) Downloading Download the latest version of JDK from http://www.java.sun.com . I have downloaded jdk-1_5_0_01-linux-i586.bin for this tutorial. Installing Change to the
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.