In jboss-cli I can do
[standalone@localhost:10990 /] /system-property=foo.bar:add(value=baz)
{"outcome" => "success"}
[standalone@localhost:10990 /] /system-property=foo.bar:read-resource
{
"outcome" => "success",
"result" => {"value" => "baz"}
}
I can list all the system variables with
[standalone@localhost:10990 /] /core-service=platform-mbean/type=runtime:read-attribute(name=system-properties)
One of them is jboss.home.dir. I do:
[standalone@localhost:10990 /] /system-property=jboss.home.dir:read-resource
{
"outcome" => "failed",
"failure-description" => "WFLYCTL0216: Management resource '[(\"system-property\" => \"jboss.home.dir\")]' not foun
d",
"rolled-back" => true
}
So this is another kind of system variable?
I read that I can do:
[standalone@localhost:10990 /] :resolve-expression(expression=${jboss.home.dir})
{
"outcome" => "success",
"result" => "D:\\dev\\eap_wildfly\\eap-7.4.0"
}
But that does not answer my question.
The
system-propertyresource is a way to set system properties or override them. In some cases, depending on when the system property is accessed, that resource might not work.The
jboss.home.dirproperty is a system property that is always set from the server. You cannot override this in thesystem-propertyresource either. If you do:The command would fail with:
You could however set the
jboss.home.dirsystem property in theJAVA_OPTSenvironment variable or via the command line like:It's not that there are multiple types of system properties, there are just multiple ways to set them. Some properties, like
jboss.home.diror system properties required by the JVM, cannot be set in thesystem-propertyconfiguration resource. However, thesystem-propertyconfiguration simply sets the system property, e.g.System.setProperty(name, value).