Eclipse - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

Eclipse Variables

Eclipse Variables

shape Introduction

This chapter Eclipse Variables demonstrate about different types of variables used in eclipse. There are more types of Eclipse Variables that user might not suspect before. Each variable has its own way of use in Eclipse. Following are the concepts covered.
  • Environmental Variables
  • Classpath Variables

Environmental Variables

shape Description

The information about the different types of available environmental variables in eclipse can be found under either the Run or External Tool Configuration menus which contains some unexplored Environment Tab that contains this very useful information. In order to check all the Environment variables in the system go to External Tool Configuration as shown in the image below. A popup window appears providing some Tabs select Environment tab and click Select button as shown in the image below. Now, a popup window appears providing a list of all the available environment variables in system. Select the required variable depending up on the operating system and programs that have been installed as shown in the image below.

Classpath Variables

shape Description

The JDT uses Classpath variables. These are useful for specifying the location of jar files or folders that are needed either during Build, Run or Configuration without making direct reference to the local file system. This makes them particularly useful in team development. In order to create a new classpath variable select Preferences from the Window menu and type Classpath in the Filter box and select Classpath Variable as indicated in the image below. There are sever built-in classpath variables where most of them have a gray slash and the word deprecated associated with them. All of these are deprecated settings and user should use JRE system library for these paths instead. User can add new Classpath Variable by clicking the New button a window get appeared, give the variable name and then navigate either a jar file or a folder using the provided buttons and save the changes by clicking OK button as shown in the image below. User can use Classpath Variables in either Build settings or in Launch Configuration settings. Adding them to the Build Settings allows the Java Builder to find outside the project. Right click on Project -> Select Properties as shown in the image below. Now, a popup window appears, navigate to Java Build Path -> Click on Libraries Tab -> Click Add Variable button as shown in the image below. Now, a popup window appears providing the list of Variables, user can add a variable directly or can extend the Variable using Extend button to select a sub folder or down to a specific jar file. As shown in the image below.

Summary

shape Key Points

  • Eclipse contain various Environment Variables and each variable has its own capabilities.
  • JDT uses classpath variables for Building, Runing or configuring the code.
  • Eclipse allow user to create an own Classpath Variable.