title: How to read/write H2 embedded DB to a file inside your JAR?
body: <p>I have an Eclipse project that is organized as follows:</p>
  
  <pre><code>MyProj/
      src/
          main/
              java/
                  &lt;All main Java source here&gt;
              config/
                  spring/
                      spring-config.xml
                  views/
                      &lt;All JSPs here&gt;
                  h2/
                      my-h2-db
          test/
              java/
              config/   } etc. for test sources
  </code></pre>
  
  <p>When I bundle it into a WAR, it is packaged like so:</p>
  
  <pre><code>MyProj.war
      META-INF/
      WEB-INF/
          web.xml
          lib/
          classes/
              spring-config.xml
              my-h2-db
              views/
                  Home.jsp
                  About.jsp
                  etc.
              com/ --&gt; root dir for all compiled Java binaries
  </code></pre>
  
  <p>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 <code>my-h2-db</code>.  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.</p>
  
  <p>So I ask:</p>
  
  <ul>
  <li>How do I access the <code>my-h2-db</code> file 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</li>
  </ul>