How do I add a directory to the eclipse classpath?

后端 未结 5 1216
礼貌的吻别
礼貌的吻别 2020-12-03 14:18

I\'m attempting to run an already existing eclipse project created by another person.
After importing it to eclipse, and attempting to Run As->Java Application, it fails

相关标签:
5条回答
  • 2020-12-03 14:48

    In Eclipse, there is a build classpath and a runtime classpath. There is also the build output location, which by default is bin. You don't want to add resources directly to bin because Eclipse can delete its contents when doing a clean build. What you need to do is add a resources folder in your project to contain any non-Java files that you want included in your build output.

    To include the contents of this resources folder in the build output (bin), right-click the project and select Properties. In the Project Properties, select the Java Build Path section, then the Source tab.

    enter image description here

    Use the Add Folder... button to select the resources folder from your project, then OK to save the changes. At that point, Eclipse will automatically copy everything from resources into bin when it builds.

    0 讨论(0)
  • 2020-12-03 15:07

    Follow these steps to get this issue fixed:

    1. Right click on Project
    2. Click on Run As and select Run Configurations
    3. Click on the classpath tab (Oxygen Eclipse)
    4. Click on user entries
    5. Click on Add External JARs.. and choose the downloaded JAR file
    6. Click Apply and run your project...
    0 讨论(0)
  • 2020-12-03 15:12

    If you don't want the properties file to be copied to the bin folder, you can try the following:

    1. Right click your project, select Build Path, select Configure Build Path..

    2. Select Libraries tab

    3. Select Add class folder..

    4. Add your resource folder.

    0 讨论(0)
  • 2020-12-03 15:13

    Right Click on the project-name in Package Explorer, select Properties, select Java Build Path on the left, select Source tab on the right, click on Add Folder, browse through the project's directories to select the resources folder or whatever you need to add to the eclipse classpath, hit OK, again hit OK. Done.

    0 讨论(0)
  • 2020-12-03 15:15

    This is for a maven project:

    1. Right click on project
    2. click on run configurations
    3. click on the classpath tab (Oxygen Eclipse)
    4. click on user entries
    5. click on Advanced
    6. first radio selection default should be 'Add Folders'
    7. click OK
    0 讨论(0)
提交回复
热议问题