Hi Tian,
Yes you are correct Constant will resolve the issue.
Also you can use Community Commons below Java Action also to fine environment
GetApplicationUrl
– This returns the runtime URL of this application.Hope it Helps!
Thanks & Regards,
Manikandan K
It has been solved by defining constants.