You should be able to do that in Tomcat by creating a "setenv.bat" or "setenv.sh" file (depending on OS) in TOMCAT_HOME/bin. Put this line in it:
Caution: because this is a System property, it will apply to ALL
java code in the Tomcat JVM. Sometimes per-application properties are preferable. Also, since it's outside of the direct scope of
J2EE, there can be maintenance issues involved, since most of us don't think of externally-imposed properties as part of the webapp and therefore don't go looking for them when we deploy to a new server or something like that.
Actually, I've never used a simple property setting in JBoss, and I'm not sure what caveats are attached to it. As I said, it's not standard J2EE usage.
Some people, when well-known sources tell them that fire will burn them, don't put their hands in the fire.
Some people, being skeptical, will put their hands in the fire, get burned, and learn not to put their hands in the fire.
And some people, believing that they know better than well-known sources, will claim it's a lie, put their hands in the fire, and continue to scream it's a lie even as their hands burn down to charred stumps.