Search code examples
javapropertiesescaping

How to escape the equals sign in properties files


How can I escape the equals sign (=) in Java property files? I would like to put something as the following in my file:

table.whereclause=where id=100

Solution

  • In your specific example you don't need to escape the equals - you only need to escape it if it's part of the key. The properties file format will treat all characters after the first unescaped equals as part of the value.