How to embed H2 database into jar file delivered to the client?

前端 未结 4 938
无人及你
无人及你 2021-01-13 02:41

I use H2 database for a desktop application in embedded mode. When I compress the application into jar file the database file is omitted. So, when I run MyApplication.jar no

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-13 02:52

    One common scheme is to put h2.jar in a lib directory relative to your application and include a Class-Path entry in your JAR's manifest with an entry for it:

    Class-Path: lib/h2.jar lib/…
    

    Addendum: This small project includes a link to the JAR specification and a handy utility for examining the manifest in situ.

提交回复
热议问题