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?
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
- 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?
- I purchased a used system. What options are available for updating my system license and purchasing a service contract?
- What are the operating environment options for using the service?