.config file for Java application?
Hi guys, I was improving my project today and wondered, if its possible, to set a config file for specific variable values which will then be parsed into the vars once the program was started. I am currently keeping my final variables in a file called Var.java which is good and works well but forces me to change the source code whenever I want to change the DB IP for example. https://pastebin.com/55bm0Lc6
Pastebin
a - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
9 Replies
⌛
This post has been reserved for your question.
Hey @netty.bootstrap! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
Basically something like config.json or something which lets you set parameters which are then used in my program
Baeldung
Getting Started with Java Properties | Baeldung
Learn how to work with key-value pairs in Java using the java.util.Properties class.
or use gson to parse a json file
or use any other library for configuration file formats
or use command line arguments (args array), or use environment variables, etc
a trillion different ways
Yh, using properties. Thanks mate
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Post Closed
This post has been closed by <@1084937449379209307>.
Post Closed
This post has been closed by <@1084937449379209307>.