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
Post a Comment