Questions tagged [properties-file]

A .properties file is either a simple text file or an XML file containing pairs of keys and values. Java and related technologies frequently use .properties files to store configuration information.

Properties files can also be used to store Strings for Internationalization and Localization and error messages.

and related technologies frequently use properties files.

Further Reading:

1316 questions
45
votes
5 answers

How to use YamlPropertiesFactoryBean to load YAML files using Spring Framework 4.1?

I have a spring application that is currently using *.properties files and I want to have it using YAML files instead. I found the class YamlPropertiesFactoryBean that seems to be capable of doing what I need. My problem is that I'm not sure how to…
ktulinho
  • 3,870
  • 9
  • 28
  • 35
42
votes
3 answers

adding comment in .properties files

By using following block of code in build.xml file
Ashwin Hegde
  • 1,733
  • 4
  • 19
  • 49
39
votes
7 answers

Eclipse wrong Java properties UTF-8 encoding

I have a JavaEE project, in which I use message properties files. The encoding of those file is set to UTF-8. In the file I use the german umlauts like ä, ö, ü. The problem is, sometimes those characters are replaced with unicode like \uFFFD\uFFFD,…
BuZZ-dEE
  • 6,075
  • 12
  • 66
  • 96
38
votes
8 answers

Get int, float, boolean and string from Properties

I have int, float, boolean and string from Properties file. Everything has loaded in Properties. Currently, I am parsing values as I know expected value for particular key. Boolean.parseBoolean("false"); Integer.parseInt("3") What is better way of…
Pratiyush Kumar Singh
  • 1,977
  • 3
  • 19
  • 39
35
votes
3 answers

Reading properties file from Maven POM file

I have Maven POM file with some configuration and in the section plugins, I have maven tomcat plugin with some configuration like this: http://localhost:8080/manager/html tomcat I'd…
Arek
  • 1,941
  • 4
  • 22
  • 27
33
votes
8 answers

Need bash shell script for reading name value pairs from a file

I have a file like name1=value1 name2=value2 I need to read this file using shell script and set variables $name1=value1 $name2=value2 Please provide a script that can do this. I tried the first answer below, i.e. sourcing the properties file but…
Walking Corpse
  • 107
  • 7
  • 31
  • 49
33
votes
4 answers

Read a properties file in powershell

Let's suppose that I have a file.properties and its content is: app.name=Test App app.version=1.2 ... how can I get the value of app.name?
jos11
  • 499
  • 2
  • 5
  • 8
32
votes
9 answers

How can I write Java properties in a defined order?

I'm using java.util.Properties's store(Writer, String) method to store the properties. In the resulting text file, the properties are stored in a haphazard order. This is what I'm doing: Properties properties =…
Steve McLeod
  • 51,737
  • 47
  • 128
  • 184
28
votes
1 answer

Gradle - Exclude file from being packaged with jar

I want to exclude AMAuthN.properties from the built jar. This file keeps showing up in the root folder of the compiled jar. The file is located at AMAuthN\src\main\resources\AMAuthN.properties relative to the project folder root. Thanks! apply…
Wes
  • 1,183
  • 3
  • 23
  • 51
27
votes
6 answers

Does .NET have an equivalent to Java's .properties files?

To jog everyone's memory, Java has these files with an extension of ".properties", which are basically an ASCII text file full of key-value pairs. The framework has some really easy ways to suck that file into (essentially) a fancy hashmap. The two…
Electrons_Ahoy
  • 36,743
  • 36
  • 104
  • 127
24
votes
5 answers

Spring @Value annotated method, use default value when properties not available

Situation I am injecting properties from .properties file into fields annotated with @Value. However this properties present sensitive credentials, so I remove them from repository. I still want that in case someone wants to run project and doesnt…
RenatoIvancic
  • 1,798
  • 3
  • 21
  • 36
24
votes
2 answers

Delete key and value from a property file?

I want to delete key and value which is stored in a property file. How can i do that????
harishtps
  • 1,439
  • 7
  • 20
  • 35
24
votes
6 answers

Loading multiple properties files

Is it possible to stack loaded properties in Java? For instance can I do: Properties properties = new Properties(); properties.load(new FileInputStream("file1.properties")); properties.load(new FileInputStream("file2.properties")); and access…
travega
  • 8,284
  • 16
  • 63
  • 91
23
votes
1 answer

What is nuget props file and what is it for?

I have looked around and read a lot but couldn't find a definitive answer that would explain as to what the "nuget.props" file is and what is it used for. Any explanation and maybe with some example?
Kartik150
  • 555
  • 1
  • 5
  • 19
23
votes
2 answers

How to load java properties file and use in Spark?

I want to store the Spark arguments such as input file, output file into a Java property files and pass that file into Spark Driver. I'm using spark-submit for submitting the job but couldn't find a parameter to pass the properties file. Have you…
diplomaticguru
  • 675
  • 3
  • 8
  • 19
1
2
3
87 88