-2

Since putting in resources folder made the database in to read-only. I wanted my database to be in the jar file.

KarlShane
  • 1
  • 1
  • 2
    Why do you want the database in “the jar file”? Deploying a JavaFX application including JavaFX components in a single jar file isn’t recommended see [packaging info in the JavaFX tag](https://stackoverflow.com/tags/javafx/info). – jewelsea Feb 26 '22 at 05:54
  • You have some misunderstandings here. The contents of the resources directory will become part of the jar file. And anything placed in the jar file is necessarily read-only. – James_D Feb 26 '22 at 17:31

1 Answers1

3

As noted in comments by James_D:

The contents of the resources directory will become part of the jar file. And anything placed in the jar file is necessarily read-only.

How to rectify this depends on what you want to do.

  1. You can install it on another machine and access over the network.
  2. You could create a new database on the local machine.
  3. If you want to seed data from an existing database in resources, then copy it out.
  4. If read-only mode is sufficient, you may be able to access the db in read only mode when it is stored in a jar, though I wouldn’t guarantee that it would work as expected.

Beyond these generalities I don’t think there is specific info to be provided without more specifics on your app.

For a tutorial on connecting JavaFX and SQLite:

jewelsea
  • 150,031
  • 14
  • 366
  • 406