How to change code settings in eclipse

Posted by Maven on Stack Overflow See other posts from Stack Overflow or by Maven
Published on 2010-04-07T19:25:48Z Indexed on 2010/04/07 19:43 UTC
Read the original article Hit count: 203

Filed under:
|

Sorry if the question title is confusing. Let me explain further.

I am building a Java project with Eclipse. In my Java product I have conditionals that determine what code is included in the product and relies on static final constants for dead stripping.

class BuildFlags
{
    public static final boolean SOME_FLAG = true; // Need to set this programmatically
}

class SomeOtherClass
{
    public void someMethod()
    {
        if (BuildFlags.SOME_FLAG)
        {
            // flag specific code
        }
    }
}

My question is how can I change BuildFlags.SOME_FLAG (above) so that I can run a special build without changing the source? Is there some way I can pass flags to the jvm (from eclipse) which I can then access to set this flag programatically?

© Stack Overflow or respective owner

Related posts about eclipse

Related posts about java