1. Luca Militello
  2. PowerBuilder
  3. Tuesday, 19 July 2022 15:05 PM UTC

hi,

i'm using PB2019 and i have a problem with the JVM.

Is it possible to set the JRE runtime when I call the JVM from executable?
I need to set a particular JRE in an application regardless of the one set in the PC where I am running the application. The idea is to put a "JRE" folder with all the files needed for that JRE version, in the same folder where the executable is present. Then I would need to point to that version of JRE bypassing, if any, the one installed on the PC. Is it possible to do such a thing? I was able to do this only by setting the environment variable "JAVA_CLASSPATH" and making it point to the version that interests me. But I don't want to change the variable on the PC because it could be used by other applications.

 

Thank you very much!

 

Luca

Accepted Answer
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 19 July 2022 23:52 PM UTC
  2. PowerBuilder
  3. # Permalink

The Windows API function SetEnvironmentVariable changes the copy of the environment belonging to the current process:

https://docs.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-setenvironmentvariablew

 

 

Comment
  1. Miguel Leeuwe
  2. Wednesday, 20 July 2022 08:12 AM UTC
As to extra clarify what Roland is saying: Doing this won't affect any other running applications. It's only for the session / process that your powerbuilder application is running in at that moment.
  1. Helpful
There are no comments made yet.
Luca Militello Accepted Answer Pending Moderation
  1. Thursday, 21 July 2022 07:59 AM UTC
  2. PowerBuilder
  3. # 1

Yes, it seems to work fine!

Thank you

 

Luca

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.