Using the Antenna and J2ME Polish preprocessors interchangeably and setting a variable value

Posted by walter on Stack Overflow See other posts from Stack Overflow or by walter
Published on 2010-05-20T07:35:30Z Indexed on 2010/05/20 7:40 UTC
Read the original article Hit count: 332

I have J2ME code, which I want to be able to compile using the J2ME Polish preprocessor or the wtkpreprocessor (antenna). They mostly use the same directives so it usually works, but ...

When I want to insert an URL value in the Java code this gives a problem. In Antenna the code would look like this:

//#ifdef my.url
    //# System.out.println("My Url");
    //#expand String location = "%my.url%";
//#else
    System.out.println("Default");
    String location = "http://www.some.default.url.com";
//#endif

and in J2ME Polish it would look like this:

//#ifdef my.url:defined
    //# System.out.println("My Url");
    //#= String location = "${my.url}";
//#else
    System.out.println("Default");
    String location = "http://www.some.default.url.com";
//#endif

I want some way in which I can use the preprocessors interchangeably and still be able to set the url in the build.xml, any ideas?

© Stack Overflow or respective owner

Related posts about j2mepolish

Related posts about j2me