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 Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Debug Like a Pro in 2025: 10 New Eclipse Java Debugger Features to Enhance Your Productivity (With Spring Boot Examples)
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 3: Understanding Janus
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 2: Understanding Neo4j
  • Introducing Graph Concepts in Java With Eclipse JNoSQL

Trending

  • Design Patterns for GenAI Creative Systems in Advertising
  • Key Takeaways From Integrating a RAG Application With LangSmith
  • The Hidden Latency of Autoscaling
  • MuleSoft MCP and A2A in Production: What 17 Recipes Reveal
  1. DZone
  2. Coding
  3. Frameworks
  4. Link to Files and Folders in Eclipse

Link to Files and Folders in Eclipse

By 
Erich Styger user avatar
Erich Styger
·
Sep. 18, 14 · Interview
Likes (0)
Comment
Save
Tweet
Share
14.0K 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. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Debug Like a Pro in 2025: 10 New Eclipse Java Debugger Features to Enhance Your Productivity (With Spring Boot Examples)
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 3: Understanding Janus
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 2: Understanding Neo4j
  • Introducing Graph Concepts in Java With Eclipse JNoSQL

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

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

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook