- Thomas Rolseth
- PowerServer
- Wednesday, 28 December 2022 04:16 AM UTC
I recently migrated and deployed an application to PowerServer 2022 for a client as a proof-of-concept. The application uses the java runtime via calls to a dll to retrieve and display image files. When the app is launched in client/server mode via a shortcut, it executes a small batch file that that adds two folders to the PATH environment variable. These folders contain the java runtime and supporting files needed to handle the image file processing. In PowerServer mode, a JVM error is thrown because the app can no longer find the runtime. I tried to call the batch file in the PowerServer project's preload event but it didn't work. I think this is because setting the path in this manner in the PowerServer environment is only temporary and by the time the app starts, the cmd instance running the batch script has shut down and the path reverts to what it was originally.
I've tried setting the path in code using RegistrySet but 1) it somethings did weird things to the path and 2) it requires that you run the app as an administrator. I've also tried using the SETX command in the batch file but in my research, came across a lot of posts saying that this was dangerous. And it didn't seem to work.
Is there another way to set the path permanently? Manually going into the environment variables and adding the path solves the problem but this is a last resort. We would prefer to not have end users do this on their computers unless there is a way to automate it.
Has anyone dealt with an issue like this?
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.