Linking an external source folder with the name "src" in an eclipse project

This is not a question of source binding in java eclipse project

Is it possible to add an external folder named "src" in eclipse as the source folder. The problem is to save the name of the external folder as "src" and not another name; for this, I tried to remove the src and bin folder from the standard eclipse java project project, and then tried to "Link source", but this does not work.

Is there any other way to do this?

Does this mean that the eclipse java src project actually points to an external folder named "src"? Similar problems also arise from the bin folder.

System Information OS: Windows 8, 32 bit Eclipse: 3.7 

Thanks.

+7
java eclipse
source share
3 answers

You need to use Eclipse to remove the existing source folder from the project configuration and then delete it from the feed system, then you can add an external linked source folder as "src".

  • Right-click the project and call "Properties ..."

  • Click Java Build Path, and then the Source tab to display a list of source folders in the build path.

  • Select "yourproject / src" and click on the "Delete" button. This will remove it from the project (and the .classpath file).

  • Exit it and physically delete the folder.

  • Return to this dialog box and this time click on "Link Source ...". Now it should work. This works for me.

+6
source share

To link to an external folder, we need to rename the folder if a folder already exists with the same name as "src", or it is better to delete this folder. After that, you can establish a connection with an external folder using any of the following methods:

Method: 1 - (Make the link manually using the code):

 1. Open the .project file from root folder of your workspace. 2. Include the below code with your file path: <linkedResources> <link> <name>folder_name_list_in_your_project</name> <type>2</type> <location>folder_path_to_include</location> </link> </linkedResources> 3. Save the file and refresh the project to include the external folder in your project. 

Method: 2 - (Make the link manually through the interface):

 1. Right click the project, select "Build Path -> Configure Build Path". 2. Choose "Source" tab. 3. Click "Link Source" button. 4. Click "Browse" to choose the folder. 5. Enter the folder name in "Folder name" field to list the external name in your project. 6. If you need to add the pattern for include and/or exclude file, click "Next" and enter the pattern. Then click "Finish". 7. Otherwise click "Finish". 

This works for me and I hope that my steps will also help you.

+5
source share

This is somewhat ugly, but you can create a hard link in your file system. At the Windows command prompt, use mklink /H src d:\path\to\external\src .

I know that the following is unlikely to be useful, but: think of a different approach.

0
source share

All Articles