What is the D option (-D) specified at Java startup?

Publication Date:January 8, 2021

INFOMARTION > What is the D option (-D) specified at Java startup?


ClassLoaderLogManager" at Java startup or "-Djava.util.logging.manager=org.apache.juli. logging.manager=org.apache.juli.ClassLoaderLogManager" in Eclipse.

I would like to explain what happens when you add this "-DXXXXXX".

Table of Contents

  1. What is D option (-D)?
  2. summary

1. What is D option (-D)?

D option (-D) is a Java system property value.

I would like to actually run it to see what happens when I set the system property values.

1-1. What happens if you run it with the -D option (-D)

I would like to run Eclipse with the D option (-D). The specific option is "-Dtest=testoption". Set as shown in the figure below.

Create a simple main class as shown below.

Execution of this main class shows that the value "testoption" is obtained with "test" as the argument as follows.

In other words, setting a system property value at Java startup allows the value to be retrieved from the System class.

3. summary

The D option (-D) at Java startup makes it possible to retrieve values from the System class. It is used when you want to dynamically set different values for different environments.

Thank you for taking the time to read this to the end.


Please click here to go to the top page of INFORMATION.


Please click here to view the profile.

■For inquiries, please contact

For inquiries about the article, please contact us here.