merours
merours

Reputation: 4106

What are the predefined variables in eclipse?

With eclipse, I know how to use variables in my launch configurations. I also know there exist a set of predefined variables such as ECLIPSE_HOME or WORKSPACE_LOC.

What I don't know is the extensive list of these predefined variables (ie : variables names and values). Is there such a resource ?

Upvotes: 15

Views: 31910

Answers (4)

Wei
Wei

Reputation: 371

I found a very good example about path variables in eclipse help documentation:

workbench user guide-concepts-ant & external tools

Lets assume your Eclipse workspace directory is: c:\eclipse\workspace and you have two projects, MyProject1 and MyProject2. The first project, MyProject1, is located inside the workspace directory, the second project, MyProject2, is located outside the workspace directory at c:\projects\MyProject2. Lets look at how the variable examples below will be expanded when an external tool is run, if the resource /MyProject2/MyFolder/MyFile.txt is selected.

    ****Variable Example ~~> Expanded Results****

    ${workspace_loc} ~~> c:\eclipse\workspace
    ${workspace_loc:/MyProject1/MyFile.txt} ~~> c:\eclipse\workspace\MyProject\MyFile.txt
    ${workspace_loc:/MyProject2/MyFile.txt} ~~> c:\projects\MyProject2\MyFile.txt
    ${project_loc} ~~> c:\projects\MyProject2
    ${project_loc:/MyProject1/MyFile.txt} ~~> c:\eclipse\workspace\MyProject
    ${container_loc} ~~> c:\projects\MyProject2\MyFolder
    ${resource_loc} ~~> c:\projects\MyProject2\MyFile.txt
    ${project_path} ~~> /MyProject2
    ${container_path} ~~> /MyProject2/MyFolder
    ${resource_path} ~~> /MyProject2/MyFolder/MyFile.txt
    ${project_name} ~~> MyProject2
    ${container_name} ~~> MyFolder
    ${resource_name} ~~> MyFile.txt
    ${build_type} ~~> none

Upvotes: 18

Daniel
Daniel

Reputation: 11

${workspace_loc}

and

${ProjDirPath}

worked for me in Eclipse Oxygen.

Upvotes: 1

greg-449
greg-449

Reputation: 111218

If you mean variables specified in things like the 'Location' field in the launch configuration then clicking the 'Variables...' button next to the field shows you a complete list of the currently defined variables.

Since plugins can add new variables to this list it isn't really possible to give a definitive list as it depends on which plugins you have installed.

Upvotes: 5

Aaron Digulla
Aaron Digulla

Reputation: 328724

Open the preferences and search for "Classpath Variables".

Upvotes: 1

Related Questions