Mega Code Archive

 
Categories / Java / Development Class
 

Have a multi-line value in a properties file

// add a slash \ to continue the value on the next line. prop1=line1\ line2\ line3 import java.net.URL; import java.util.Properties; public class Main {   public static void main(String args[]) throws Exception {     Properties props = new Properties();     URL url = ClassLoader.getSystemResource("props.properties");     props.load(url.openStream());     System.out.println("prop1 :\n " + props.get("prop1"));     System.out.println("prop2 :\n " + props.get("prop2"));   } }