Skip to content

Commit e38706f

Browse files
authored
Merge pull request #25382 from eclipse-ee4j/ondromih-env-vars-before-sys-props
Option to prefer env vars when resolving variables in JVM options
2 parents c29382c + 523e24e commit e38706f

File tree

6 files changed

+154
-61
lines changed

6 files changed

+154
-61
lines changed

docs/administration-guide/src/main/asciidoc/jvm.adoc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ xref:reference-manual.adoc#create-jvm-options[`create-jvm-options`] subcommand.
5555
To create more than one JVM option, use a colon (:) to separate the
5656
options. If the JVM option itself contains a colon (:), use the
5757
backslash (\) to offset the colon delimiter.
58-
+
59-
Information about properties for the subcommand is included in this help
60-
page.
6158
3. To apply your changes, restart {productName}. See
6259
xref:domains.adoc#to-restart-a-domain[To Restart a Domain].
6360

@@ -78,7 +75,7 @@ Command create-jvm-options executed successfully.
7875

7976
See Also
8077

81-
You can also view the full syntax and options of the subcommand by
78+
You can also view the full syntax and options of the subcommand in the xref:reference-manual.adoc#create-jvm-options[`create-jvm-options`] reference manual, or by
8279
typing `asadmin help create-jvm-options` at the command line.
8380

8481
[[to-list-jvm-options]]

docs/reference-manual/src/main/asciidoc/create-jvm-options.adoc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,18 @@ are preceded by the dash character (`-`). For example:
6161
If the subcommand specifies an option that already exists, the command
6262
does not re-create the option.
6363

64+
Variable references, e.g. `${variable}`, can be used anywhere in JVM options. In that case, they are resolved as follows:
6465

65-
[NOTE]
66+
1. Profiler properties in Java Config
67+
2. System properties in JVM options in Java Config
68+
3. System properties in instance, cluster, or config that match the instance being started
69+
4. System properties in the JVM of the server launcher (note that they may be different from properties in the JVM of the server if it starts with a different JVM)
70+
5. `asenv` properties
71+
6. Environment variables
72+
73+
If a property `org.glassfish.envPreferredToProperties` is defined as `true` (in any source except environment variables), then environment variables take precedence over other sources, instead of being the last resolved source. It's also possible to override options and system properties defined in JVM options with an environment variable that either has the same name, or same name if case is ignored and non-alphanumeric characters are replaced with the `_` character. For example, a property `-Dmy.name` can be defined by redefined by environment variables `my.name`, `my_name`, or `MY_NAME`.
74+
75+
[CAUTION]
6676
====
6777
Ensure that any option that you create is valid. The subcommand might
6878
allow you to create an invalid option, but such an invalid option can

0 commit comments

Comments
 (0)