I have an Eclipse project that is organized as follows:
MyProj/
src/
main/
java/
<All main Java source here>
config/
spring/
spring-config.xml
views/
<All JSPs here>
h2/
my-h2-db
test/
java/
config/ } etc. for test sources
When I bundle it into a WAR, it is packaged like so:
MyProj.war
META-INF/
WEB-INF/
web.xml
lib/
classes/
spring-config.xml
my-h2-db
views/
Home.jsp
About.jsp
etc.
com/ --> root dir for all compiled Java binaries
I need to write code that is capable of CRUDing an H2 database (and all the tables, users, etc. that go with it) that for this example I have called my-h2-db. This way the app can work with the same DB file no matter if I'm testing from inside Eclipse, or if I'm actually using the deployed WAR.
So I ask:
- How do I access the
my-h2-dbfile both from the Eclipse and runtime (WAR) classpath, since it is packaged in a different location than where it lives in the Eclipse project?; and