简体   繁体   中英

configure classpath in eclipse

How can I configure the classpath so I can use this code without errors

GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
ctx.load("classpath:appContext/messageSource.xml");

the error I get now is

Exception in thread "main" 
org.springframework.beans.factory.BeanDefinitionStoreException:
IOException parsing XML document from class path resource [messageSource.xml]; 
nested exception is java.io.FileNotFoundException: class path resource 
[messageSource.xml] cannot be opened because it does not exist

Pick Build Path > Use as Source Folder an apply it to the appContext folder. I believe Eclipse adds an entry in the project's .classpath file, which is in your best interest.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM