This discussion is archived
1 Reply Latest reply: Dec 17, 2008 10:00 PM by 843785 RSS

Quoting in java properties files

843785 Newbie
Currently Being Moderated
Folks,

I've got a properties file which is used both by the ABT's build.xml and by J2EE application itself.

I would like to name my ABT-output directory output/#today (just so that it appears at the top of the listing) but the # (according to my editor) makes the rest of the line a comment.

Please does any know if I can just quote the property string... like so:
abt.output.dir="${abt.home.dir}/output/#today"
I'm not in a position to test it myself right now ;-( though I will be tonight, in about 4 hours).

Thanx all.
  • 1. Re: Quoting in java properties files
    843785 Newbie
    Currently Being Moderated
    OK folks,

    create PropsTest.properties on windows or unix
    echo abt.output.dir=${abt.home.dir}/output/#today >PropsTest.properties
    echo abt.output.dirq="${abt.home.dir}/output/#today" >>PropsTest.properties
    PropsTest.java
    import java.util.Properties;
    import java.io.FileInputStream;
    
    class PropsTest
    {
      public static void main(String[] args) throws Exception {
        Properties props = new Properties();
        props.load(new FileInputStream("PropsTest.properties"));
        props.list(System.out);
      }
    }
    1.6_7 on XP produces exactly what I'd hoped for...
    C:\java\home\src\krc>java PropsTest
    -- listing properties --
    abt.output.dirq="${abt.home.dir}/output/#today"
    abt.output.dir=${abt.home.dir}/output/#today
    ... So thanx anyway and sorry to bother you all.

    Cheers. Keith.