Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 726285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:26:04+00:00 2026-05-14T06:26:04+00:00

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

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:26:04+00:00Added an answer on May 14, 2026 at 6:26 am

    You do this by setting a system property value (see the docs on java) and then getting it from System.getProperty(). System properties can be set in Eclipse by editing the run configuration.

    Note that properties are set as strings — you will have to convert it to a boolean.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry about the rubbish question title. I have a table SET_DEFINITIONS like this: SETKEY
sorry for the cryptic question title. I'm having a strange problem and i have
Sorry for the long question title. I guess I'm on to a loser on
Sorry for the basic question - I'm a .NET developer and don't have much
The title may be confusing so ill try to elaborate. I have a business
Sorry, I don't really know how to title this question. Here's my code in
I certainly don't know how to title this question, sorry. I'm having some problems
Sorry if the question is confused, as I'm confused myself. I'm working around these
Sorry for the second newbie question, I'm a developer not a sysadmin so this
Sorry for the simple question but I feel like there's a smarter way to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.