environment : Java Glossary


Different operating systems use different methods of storing parameter and configuring data for programs. This list of parameters, usually including PATH and CLASSPATH, is called the set environment.
Overview Key Environment Variables
W95/W98/Me Environment Macintosh
NT/W2K/XP/W2K3/Vista/W7 Environment Learning More
Environment Accessing Kludges Links


W95, W98 and Me Environment

Windows uses a region called the SET environment where you can place configuring information for programs. It needs to be a decently large size to work with complex programs. If you get out of environment messages you must modify your C:\config.sys file. Look for a line in it like this:
shell=C:\Windows\command.com C: /u:255 /e:16384 /p

If you find it, make it look exactly like that. If don’t see it, add it. You will need to use a text editor such as NOTEPAD to make the change. The /e:17374 specifies the desired size of the set environment in bytes. Make sure there exists a file called: C:\Windows\command.com. If not look for one in C:\ and copy it over.

NT/W2K/XP/W2K3/Vista/W7/W8/W10 Environment

NT, W2K, XP, W2003, Vista, W2008, W7-32, W7-64, W8-32, W8-64, W2012, W10-32 and W10-64 Environment

With NT, W2K, XP, W2003, Vista, W2008, W7-32, W7-64, W8-32, W8-64, W2012, W10-32 and W10-64, you don’t need to do this since the environment automatically expands as needed. Further, there is no config.sys or autoexec.bat file.

You can export the NT, W2K, XP, W2003, Vista, W2008, W7-32, W7-64, W8-32, W8-64, W2012, W10-32 and W10-64 set parameters from the registry two ways that don’t require JNI (Java Native Interface) :

Restart any command prompt boxes after making changes to the environment. Reboot if your changes would affect any programs started with the task manager.

Environment Accessing Kludges

Key Environment Variables


Macintoshes don’t support a SET environment comparable to Windows or Linux, so you fake it with a magic file. I don’t own a Mac, so this information comes courtesy of Owen Jacobson.

The desktop picks up its environment from a property list file in ~/.MacOSX/environment.plist. Both the directory and the file must be created; neither exists by default. The file can be created with the Property List Editor utility included in the developer tools; you can also create a property list with any text editor. Each property in the root dictionary defines one environment variable.

Here is a minimal *.plist file:

EDITOR = mate_wait;
EXAMPLE_VAR = /Users/owen/A Value With Spaces;

This file is loaded at login time; changes to the file only take effect when you log out and back in. Shell-style expansion of variables in values is not applied to environment variables defined here.

OS X also ships with bash, which launches whenever you run Terminal; it respects the ~/.bash_profile. Environment variables defined in ~/.bash_profile only affect bash, e.g., the terminal. Most of the environment variables Java cares about (PATH, ANT_HOME, etc) should be set this way, as they only make sense in the context of the terminal anyway. Locale and language settings are better left to the OS X localization code (which sets appropriate environment variables for you).

For people doing server development, a sensible value of JAVA_HOME is /Library/Java/Home. Owen Jacobson tells me he has never had to set it, even for JBoss or Maven.

In general OS X discourages using the environment in the way most UNICES and Windows do. In general, only UNIX-heritage applications use it at all; native programs tend to prefer the Preferences API (Application Programming Interface) and the associated glue in the AppKit framework.

Learning More

Oracle’s Javadoc on System.getenv : available:

This page is posted
on the web at:


Optional Replicator mirror
of mindprod.com
on local hard disk J:

Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

Your face IP:[]
You are visitor number