DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Building Scalable Real-Time Apps with AstraDB and Vaadin
Register Now

Trending

  • Microservices With Apache Camel and Quarkus
  • Web Development Checklist
  • Playwright JavaScript Tutorial: A Complete Guide
  • AI Technology Is Drastically Disrupting the Background Screening Industry

Trending

  • Microservices With Apache Camel and Quarkus
  • Web Development Checklist
  • Playwright JavaScript Tutorial: A Complete Guide
  • AI Technology Is Drastically Disrupting the Background Screening Industry
  1. DZone
  2. Coding
  3. Frameworks
  4. Link to Files and Folders in Eclipse

Link to Files and Folders in Eclipse

Erich Styger user avatar by
Erich Styger
·
Sep. 18, 14 · Interview
Like (0)
Save
Tweet
Share
12.43K Views

Join the DZone community and get the full member experience.

Join For Free

eclipse projects have the nice features that they can link to files and folders: so instead of having the physical file, it is just a pointer to a file. this is very cool as that way i can point to shared files, or keep files in a common place referenced from projects, and so on.

linked folder and file in eclipse

linked folder and file in eclipse

as with most things in eclipse, there is not a single way how to do things. so i’m showing in this post several ways how to link to files and folders.

creating a new link

select the folder/project where to create a link to a file. use the context menu with n ew > file (or the menu file > new > other > general > file ):

new file

new file

that opens a dialog to create a new file. i can select which project/folder i want to use for this:

new file dialog

new file dialog

next, click on ‘advanced’, enable ‘link to file in the file system’ and browse to the file you want to link to:

link to file

link to file

this will set the link to the file:

specified link to file

specified link to file

as an absolute path (c:\….) is probably not really what you want, there are eclipse path variables you can use:

path variables

path variables

:idea: note that these are eclipse path variables (not eclipse build variables), see “ eclipse build variables “.

to use the path variable for the link, use the ‘extend…’ button and then select the file, then press ok:

extending path variable

extending path variable

this now uses a path variable for that link. note that it shows as well to which file it resolves:

resolved path variable for linked file

resolved path variable for linked file

press finish, and the link will be created. note the small ‘arrow’ in the icon (see “ icon and label decorators in eclipse “) to show a linked file:

linked file

linked file

modifying a link

if you right-click on that linked file and select ‘properties’ of it, you can see that it is really a linked file, with the link information, and you can change/edit that link any time:

linked file properties

linked file properties

linked folder

as for link to files, its possible to create ‘link to folders’. it works the same way: select the folder, then use file > new > folder:

creating new folder

creating new folder

  • use default location : this creates a normal folder.
  • virtual folder : this does not create a physical folder, but a virtual ‘container’ where i can place links or other virtual folders. this is useful to organize links and virtual folders, without the need for a physical folder.
  • linked folder : like linked files, this links to a folder.

:idea: the cool thing about linked (source) folders is: when i add new files to that folder where it links to, the projects with that linked folder to it will ‘see’ the extra files too, and that way new files are automatically added to the project. i do this many times, and it is like a ‘library’ folder for me: i can add a new source file to that ‘library’ folder, and every project linking to that folder will automatically have it added. :-)

deleting links

linked files and linked folders can be deleted from the project too. in that case, the destination of the link is *not* deleted, only the link:

deleting a link to a folder

deleting a link to a folder

using drag & drop

as mentioned at the beginning: there are multiple ways to do the same thing in eclipse. instead using the top menu, or using the context menu, i can use drag & drop. to create links, i need to hold the ctrl key:

drag and drop with ctrl pressed to create a link

drag and drop with ctrl pressed to create a link

:idea: notice that during the drag&drop with ctrl key pressed the icon gets a ‘+’ to show copy/linking mode.

when i drop the file: i get the usual choices how i want to create the link:

link to files and folders dialog

link to files and folders dialog

drag&drop of files and folders do not work inside eclipse. what works as well under windows is to drag&drop a file or folder from the windows explorer :-).

summary

links to files and folders are a cool thing in eclipse, and they can be created with menus or even simpler with drag&drop. this is not limited to inside eclipse: i can drag&drop from outside with the windows explorer and that way can link to files and folders everywhere :-)

happy linking :-)

Links Eclipse

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Microservices With Apache Camel and Quarkus
  • Web Development Checklist
  • Playwright JavaScript Tutorial: A Complete Guide
  • AI Technology Is Drastically Disrupting the Background Screening Industry

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: