Learn how to copy the path of a file or directory in the clipboard using a plugin in NetBeans.

How to copy File Paths and Directory path to clipboard easily in NetBeans

In comparison with a paid IDE for example PHP Storm, NetBeans lacks of many little things that every developers needs, for example the possibility to copy in the clipboard the path of a file or directory with a single click. NetBeans 8.2 by default offers the possibility to copy the filepath of a file that is being currently modified in the toolbar:

Copy Filepath From Editor

However there still no posibility to copy with a couple of clicks the path of a directory as you would need to open the explorer and search for the path of the folder. Fortunately NetBeans allows you to add plugins easily (official and non-official plugins). If you are willing to add the posibility to NetBeans that with a couple of clicks you will be able to copy the path of files, directories, open the directory of the files or even open a terminal within the path of the directory, follow the steps on this tutorial and you will be ready to go !

1. Download and install Path Tools Plugin

As first step you need to download the Path Tools plugin from the official NetBeans website here. Click on the download button and a file, namely 1210303533494_org-netbeans-modules-pathtools.nbm will be download in your browser, this file is the Plugin that can be installed through the Plugin Installer of NetBeans, once you have the file keep its path in mind as you will need to indicate its location in NetBeans for its installation.

As next, open the Plugin Manager through Tools > Plugins:

NetBeans Plugin Manager How to Open

This will open the helper that allows you to install custom plugins. Then, open the Downloaded Tab and click on Add Plugins ...:

NetBeans Plugin Manager

When you click on Add Plugins a new file dialog selector will appear, here you need to search for the previously downloaded file and select it, then click on open:

NetBeans Add Plugin Dialog

After selecting the file, the plugin will be added to NetBeans, however it isn't installed nor active, so you will need to select it from the list and click on Install:

NetBeans Install Folder

Follow the installation, restart NetBeans and the plugin will now be able to be used.

2. Using the plugin

After the installation of the plugin and the restart of NetBeans, you will be able to use the plugin. The first important added feature is the possibility to copy the path of a directory to the clipboard by simply right clicking on the directory and selecting Copy Paths:

Copy folderpaths to clipboard in NetBeans

The Explore Paths is useful as well because its opens the directory in the explorer of your operative system. The other important feature is the implementation of 4 new buttons in the top toolbar, these buttons are respectively:

  • Copy Paths: the copy paths button copies the absolute path of the selected item in your project explorer (path of the folder if a folder is selected or the path of the file if a file is selected).
  • Explore Path: opens the selected folder of your project explorer in the Windows Explorer (if a file is selected, then the container folder will be opened).
  • Shell on Path: starts a command prompt with the absolute path of the selected folder as start point (if a file is selected, then the container folder will be the start point).
  • Edit Path: although at first view is a little useless, allows you to open a file with the default text editor of your operative system (notepad.exe).

Happy coding !


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors