Skip to content

Setting up properties in config

muhammad-amirul-96 edited this page Feb 25, 2021 · 2 revisions

Step-by-step Solutions:

.properties is a file extension for files mainly used in Java to store the configurable parameters of an application. In TrainingLabs, we use the config.properties file to store the URL link to the pretrained model and the dataset, as well as the path to the local directory.

The file can be access in TrainingLabs > dl4j-cv-labs > src > main > resources > config.properties as in the image below:

Inside the config.properties file, we will find something like this:

Later, when we want to call the value of the property inside the config.properties file, we can call the key of that particular property as follows:

In the image below, we are calling the dl4j_home.data property which maps to the value .deeplearning4j/data. Calling a property that is not listed inside the config.properties will lead to NullPointerException since the pointer is not pointing at anything. For example, instead of dl4j_home.data, I call dl4j_home.dat which is not listed in the config.properties file as follows:

Running the code will results as follows:

Key Takeaway

Please make sure the property is registered properly inside the config.properties file, and avoid from any typo when calling the property.