Java - Problem with the classpath on Eclipse

前端 未结 3 416
走了就别回头了
走了就别回头了 2020-12-09 06:20

I\'m trying to recompile a project I\'ve been working on and I keep getting an error message when trying to load a property file:

The system cannot find the path          


        
3条回答
  •  一生所求
    2020-12-09 06:57

    There 2 different classpaths, build classpath and runtime classpath. The one you are setting is the build classpath.

    Check your runtime classpath by going to Run -> Run Configurations and select your application configuration. Check the classpath setting there.

    There is another workaround for this also. Eclipse by default will include your output folder (usually named bin) in your classpath. Typically anything that are not compilable in src folder will be copied to bin as is. I assumed your property file is not located in src folder. What you can do is to open your project property and add the folder where your property is located into Java Buld Path -> Source (tab). This way eclipse will copy the content of that folder into bin and will be in the classpath.

提交回复
热议问题