LaunchDarkly Sample Java Application
We've built a simple console application that demonstrates how LaunchDarkly's SDK works.
This project uses Gradle. It requires that Java is already installed on your system (version 8 or higher). It will automatically use the latest release of the LaunchDarkly SDK with major version 5.
src/main/java/Hello.javaand set the value of
SDK_KEYto your LaunchDarkly SDK key. If there is an existing boolean feature flag in your LaunchDarkly project that you want to evaluate, set
FEATURE_FLAG_KEYto the flag key.
static final String SDK_KEY = "1234567890abcdef"; static final String FEATURE_FLAG_KEY = "my-flag";
- On the command line, run
./gradlew run(or, on Windows,
The demo should print
"Feature flag '<flag key>' is <true/false> for this user".