0

I have created a Java Swing program which uses a SQLite database to store the hardware details of the pc. When I run that program as a java application, hardware details get stored in the DB. I have to generate an exe of that java program. I created an exe using ant build, launch4j and Innosetup. I added the DB(sys_data.db) in launch4j in classpath. But when I run that exe, the hardware details doesn't stored in the DB.

Any suggestion please?

Buhake Sindi
  • 85,564
  • 27
  • 164
  • 223
Manikandan
  • 2,463
  • 5
  • 51
  • 91

1 Answers1

0

A database is not a jar file - therefore this is totally unrelated to the classpath. If you load the db by a relative path the program will search in the current directory.

My suggestion would be to use a fully qualified path when loading the SQLite database. You can retrieve for example the path where your main jar is located - see How to get the path of a running JAR file? for details.

Community
  • 1
  • 1
Robert
  • 36,354
  • 15
  • 89
  • 140