#.config file for Java application?
1 messages · Page 1 of 1 (latest)
Basically something like config.json or something which lets you set parameters which are then used in my program
yeah, just load the file on startup
you would load the file, for example using Gson for json files. then you would decide which variables the data should be assigned to
you could also map it to a class
for example, you could map your Vars class to a json file. look into Gson
ok i see, do you have a link to a documentation or something
you could even just use a text file, then read the plain text file
List<String> lines = Files.readAllLines(...);
// parse the lines```
you could use a Properties file
many different options
Ok nice. Thanks, do you know by any chance, if there is a way in Java, to start a SSH listener port which will on connection from the client prompt for username and password?
Java has a built-in class for this called Properties
Ok ill do research on that
omg ok so thats actually OP
and easy
lol
keep in mind, Properties is pretty simplistic, key/value pairs
yes
I see xd
if you ever need nested data, you'll have to change formats
otherwise, Properties would be the easiest
yes
Can you help with this one maybe
use a secure socket to listen on the port
How do I do dat
oh my bad, thought you said ssl. you could use JSch
its as secure as SSH2, since its just an implementation of it
need what?
thats just the class definition
you'd use a Properties object to read the file
kk good
look at examples online if needed
I was just confused bc I wondered why anyone would reuse the constructor and attributes of a class just for properties xD
not sure what you mean by that
well, "extends" just inherites the attributes and methods, so I was confused by that line as it inherits an empty class basically to "Hashtable"
the class isnt empty
oh
extending from Hashtable just says "a Properties object is a Hashtable", allowing Properties to inherit from Hashtable
extending creates an "is-a" relationship between 2 types
ohhh ye, in school we are just using it to like inherit attributes and classes yk