Reputation: 13714
There are various similar questions but none answers where to embed the environment variable. Unfortunately, in my case there is already a file named setenv.bat
which contains a lot of code.
There is a lot of code in it. So the question is where do I write (on which line at what place within setenv.bat
)
set "JAVA_OPTS=%JAVA_OPTS% -Dblockchain.callbackUrl=http://example.com/"
I wrote it at the beginning of setenv.bat
but it doesn't work.
FYI : I installed tomcat using the windows installer, hence, I have tomcat7w.exe
I'm running tomcat as a windows service
I'm trying to access this variable through Spring in my webapp as :
@Value("#{systemProperties['blockchain.callbackUrl']?:'http://localhost:8080/'}")
private String callbackHost;
Update
I tried setting it in catalina.bat, still didn't worked.
Upvotes: 1
Views: 3721
Reputation: 13714
When we create a service from Tomcat installation on windows, such parameters have to be defined in service.bat
before installing the service with service.bat install
command.
--JvmOptions "-Dblockchain.callbackUrl=http://www.example.com/;-Dcatalina.home=%CATALINA_HOME
Add the environment variables to JvmOptions
in service.bat
as shown above.
Upvotes: 1