Hi,

I got it to work, as often this was not as simple as expected, long story as 
short as possible.

It was not possible to set java env vars (JAVA_HOME and PATH). Because The VM uses 
"Ubuntu 20.04.5 LTS".

Ubuntu by default uses update-java-alternatives to handle Java versions. We had only JDK 
11 so far, it's easy to add JDK 17 with "alternatives".
Update-alternatives uses symlink to handle env vars. So setting java env vars 
in scripts (or even in terminal) simply does not work.

So I thought that by using something like*

   |update-java-alternatives -s java-versionexport 
JAVA_HOME=/usr/lib/jvm/|||java-version|/||export PATH=$PATH:$JAVA_HOME|

   ||

in scripts it would be easy to set the necessary versions.

But update-java-alternatives requires to use sudo.
And, for security reason, all demo scripts must be run with ofbizDemo user.
Again for security reason, ofbizDemo is not a sudoer.

So update-java-alternatives was not an option.
I did not know anything about "SDKMAN!"** but it seemed to be a solution.
Again, not as simple as expected. SDKMAN uses BASH to set env vars and Ubuntu uses DASH 
behind "sh".
So few adjustments were necessary. You can see them at***

* https://aboullaite.me/switching-between-java-versions-on-ubuntu-linux/
** https://sdkman.io/
*** 
https://gitbox.apache.org/repos/asf?p=ofbiz-tools.git;a=commit;h=110483791d1bf640fd15e2d5589c940239c3c444

Enjoy!

Jacques

Le 20/01/2023 à 17:00, Jacques Le Roux a écrit :
Hi Michael,

I'm sorry, somehow I missed your email. I can't give you access, that's Infra's 
privilege.
We recently had a discussion with Daniel on Slack OFBiz channel about that, 
here is the relevant part copy

   <<To get SSH access to the demos VM just 
followhttps://infra.apache.org/vm-for-project.html#ssh-keys
<https://infra.apache.org/vm-for-project.html#ssh-keys>
   You need also to ask Infra for being a sudoer as explained 
athttps://infra.apache.org/vm-management.html
<https://infra.apache.org/vm-management.html>So first you need to ask the PMC>>

As your are a PMC, I think you don't need need to ask the PMC.

I thought that setting different JAVA_HOME environment variable values in one 
of the scripts would have undesirable side effects on the other scripts.

Anyway let me try your trick as it seems indeed easy.

Jacques

Le 14/01/2023 à 10:10, Michael Brohl a écrit :
Hi Jacques,

I have no access to the server right now so I cannot see where the Java 
installations reside or which Linux distro we use.

Can you give me access, preferably per ssh/public key to the machine?

On Ubuntu and Mac, you just install the different JDK's beside each other and point to the JDK which should be used by setting the JAVA_HOME environment variable in the start script. Easy.

Regards,

Michael Brohl

ecomify GmbH - www.ecomify.de


Am 13.01.23 um 18:23 schrieb Jacques Le Roux:
Le 13/01/2023 à 14:15, Michael Brohl a écrit :
set JAVA_HOME to the right JDK in the OFBiz start/stop scripts
Hi Michael,

That's a good news, how would you do that? A patch at 
https://github.com/apache/ofbiz-tools/tree/master/demo-backup would be welcome

Thanks

Jacques

Reply via email to