I still can't understand how you would have liked to operate.
There may be a few tricks left, but, since you say that you are not allowed to set different JVM variables in the two environments (which would be a very simple solution), it is not clear to me what other ways of distinguish the environments are allowed.