I do not know what a properties file is.
A Java .properties
file is just a configuration file with key=value
pairs on each line, for example, a Windows file (in fact, C ++ / C #) .ini
.
See also:
Is it possible to create a properties file from a text editor and set the path in the catalina.properties file in the Tomcat / conf folder?
It comes down to the fact that the file must be placed in the Java classpath. In the case of a Java web application, you can put it in one of the existing paths that covers the class path, for example /WEB-INF/classes
(in the IDE, placing the file in the root folder of the Java source should make it end in /WEB-INF/classes
). You can, of course, also put it in another place and add your root path to the class path, as you are trying to do with shared.loader
Tomcat.
So anyway I did the following:
This is not true, it should point to a folder representing the root of the class path, or a separate JAR file. In your case, it should be:
shared.loader= /home/shaunkoo/NetBeansProjects
Thus, the contents of the specified folder becomes part of the class path.
and upload the file through
private static final String PROPERTIES_FILE = "/NetBeansProjects/dao.properties";
This is not true, the path for the context class loader cannot start with /
and should not point to a folder that is not inside . You indicated that /home/shaunkoo/NetBeansProjects
is part of the class path, so any files inside the folder are accessible to the class loader, not the folder itself. In your case, it should be:
private static final String PROPERTIES_FILE = "dao.properties";