0

In my maven project, i need to address sqlite class which is located in resources/db

I have a db in the absolute path like:

C:/Users/Salman/Desktop/Courses/Thesis/Code/ADTool2-master/project/src/main/resources/db/smartADTool.sqlite

and the class file which needs this file is:

C:/Users/Salman/Desktop/Courses/Thesis/Code/ADTool2-master/project/src/main/java/ee/ut/smarttool/DB/DB.java

to extract the relative path I used the following relative address:

../../../../../resources/db/smartADTool.sqlite

but it seems that i the db is not located there.

user5363938
  • 831
  • 3
  • 17
  • 32

1 Answers1

0

Since it is in the same project, You can refer it using

db/smartADTool.sqlite

Example -

ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("db/smartADTool.sqlite").getFile());
Srikanth Balaji
  • 2,638
  • 4
  • 18
  • 31