Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

I am passing a system environment variable myenv to a Win32 service via -Dmyprop=%myenv% in the JVM options. Why is the value of myprop blank when read in the Win32 service?

0
Posted

I am passing a system environment variable myenv to a Win32 service via -Dmyprop=%myenv% in the JVM options. Why is the value of myprop blank when read in the Win32 service?

0

Environment variables are not refreshed for Win32 services until the machine is rebooted. This is by Windows’ design, and applies to all Win32 services, not just NativeJ-generated ones. Hence, whenever you add or update a system environment variable for a Win32 service, you need to reboot the machine in order for the new value to take effect.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123