How to read a properties file

Question from Kiryo#9472

i need to make that my app shows the specific value in xml file should i use scanner? or there is another way i need to extract

# Rate Exp Sp
RateXp = 4.
RateSp = 4.

the value of for example this^

actually not the xml but .properities

Get your .properties file as an input stream, then

final var properties = new Properties();
try (InputStream is = ...) {

Easy peasy, then just


Full example:

public record Config(int rateXp, int rateSp) {
    public static Config loadFromClasspath() {
        final var properties = new Properties();
        try (final var inputStream = getClass().getClassLoader().getResourceAsStream("")) {
        catch (IOException e) {
            throw new UncheckedIOException(e);
        return new Config(

<- Index