Java Path, System, and Environment Variables

Eclipse uses path variables in build configuration scripts to create portable projects.

Environment variables are defined within a hierarchy, which defines each one’s scope of access.

  1. The operating system. These are the current user’s environment variables (UserDomain.UserName). For Example,

    USERNAME = Chris
  2. The Eclipse IDE and the Java Virtual Machine ( referred to as System Properties of the Java Platform). To maximize portability, never refer to an environment variable when the same value is available in a System Property. For example, if the operating system provides a user name, it will always be available in the system property

  3. The current Workspace in Eclipse.

  4. The current Project within the current workspace. These are the environment variables that the build configuration can access directly. For example,

    Path: /java_3rdParty

To see and create Path Variables for a particular java project:

  1. Right-click the java project in Project Explorer, and click Properties.
  2. Navigate to Resources > Linked Resources > Path Variables.

Use PROJECT_LOC as a starting point, and create


Note: To use these in an Ant script, you have to define and assign equivalent local variables.

5 replies on “Java Path, System, and Environment Variables”

Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be book-marking and checking back frequently!

Leave a Reply