Struktura projektu:
Aktualnie mam plik properties w katalogu resources. Gdzie najlepiej go umieścić, żeby później po stworzeniu jara/exe aplikacji nie było problemu ze znalezieniem ścieżki do pliku.
String path = getClass().getResource("/db.properties").toString();
Properties prop = new Properties();
InputStream input = null;
try {
input = new FileInputStream(path);
// load a properties file
prop.load(input);
// get the property value and print it out
System.out.println(prop.getProperty("javax.persistence.jdbc.user"));
} catch (IOException ex) {
ex.printStackTrace();
}
java.io.FileNotFoundException: file:\D:\Documents\IdeaProjects\inzL1G3\TaskManager\target\classes\db.properties (The filename, directory name or volume label syntax is incorrect)
Plik jest pod tą ścieżką:
Pytanie o co chodzi z tą nazwą?