java - How to reference a file in Eclipse that is not in src -


i'm trying resource mybatis. tutorial states need following in connection factory:

string resource = "org/mybatis/example/configuration.xml"; reader reader = resources.getresourceasreader(resource); sqlmapper = new sqlsessionfactorybuilder().build(reader); 

my directory structure is:

src/ com/ utils/ mybatisconnectionfactory.java config/ configuration.xml

i having troubles referencing configuration file. tried "config/configuration.xml", "configuration.xml" , "/config/configuration.xml".

anyone have idea do?

you can add config directory source-folder (right-click > build path > use source folder).

thus configuration files go on root of classpath , accessible via getclass().getresourceasstream("/configuration.xml")


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -