![]() ![]() ![]() This is the next important step while working with config.properties file. ![]() Loading properties is important or your Eclipse would treat it as just an unclaimed file. Now you can load these properties to be used in your code. Step 4: Provide properties in your config.properties file: I will just go ahead and add some properties that I may need for my code in the long run. It will create a blank properties file for you where you can now store all your properties to be extracted whenever you need an input somewhere in your code. Step 2: Then in the New File dialog box, in the text box File Name, type the name as “config.properties”: Step 1: Right click on the folder you wish to place your config file in and then click on New> File How to Create a config.properties file in Eclipse In here, we are going to see exactly that – how to create a config.properties file in Eclipse, load it and then use it effectively. It is a good coding practice to use a config.properties file where you can store all your fixed client requirements and use your code to call each values using the getProperty() method. So that you retrieve your data using your code, so that nothing is hard coded. You see it’s a good idea to place all your properties in a different file. In here we are going to see how to create a config.properties file in Eclipse and how to load it and bring it in use.
0 Comments
Leave a Reply. |