How to control the JDK/JRE used by OpenMRS when using JETTY?

Greetings community.

I have found that when I launch OpenMRS locally using the Jetty server, it was possible for me to tweak the environment so that Maven (which am using to launch the web app via “mvn jetty:run”) is pointed to an alternative JDK/JRE 1.7. But, upon loggin into OpenMRS, checking the SystemInfo page shows that somehow, OpenMRS is still pointing to Java 8, which isn’t what I want.

So, my question: given that I launch maven from an environment exposing only Java 7, how is it that OpenMRS still reflects Java 8? Also, noticing as am launching OpenMRS from the webapp directory, how can one explicitly specify the desired JDK/JRE for OpenMRS given this directory doesn’t seem to contain any openmrs.properties file?

Am asking because there are some issues I ran into while attempting to run an OMOD. The deployment logs contain errors which the community history indicates are related to wrong JDK, thus the need to force OpenMRS to use JDK 7, but it’s proving to be tricky getting that working.

What are your environment are you working in ?

Ubuntu 20 in a VM

Which OpenMRS platform version are you running?

2.4.0 release

@dkayiwa while at it, I wonder, after looking at the documentation around the OpenMRS runtime properties file, there seems no hook to specify a custom JRE in that file. Is this something at all possible via some config file, or one has to rely on tweaking the JETTY/environment JRE?

What does this command return? mvn -v

Apache Maven 3.6.3 Maven home: /usr/share/maven Java version: 1.7.0_75, vendor: Oracle Corporation, runtime: /usr/local/java/java-se-7u75-ri/jre Default locale: en_US, platform encoding: UTF-8 OS name: “linux”, version: “5.8.0-44-generic”, arch: “amd64”, family: “unix”

After I have changed $JAVA_HOME to point to 7

Point it to Java 8

Mr. Kayiwa, you’re right. The moment I tried to run “mvn jetty:run” with 7, it resulted in incompatibility issues as in this thread. They also recommend switching to 8, though it was the case that the mvn plugin docs mentioned 7 as well!

However, going back to the original issue - which is to tweak or adjust the JDK seen by OMRS, is it at all possible that we can still go back to an OMRS on 7, or is 8 the default/standard now?

OMRS is crazy! Chasing the original bug feels like running about in circles!

After switching to Java 8, does running mvn jetty:run still point to Java 7 in the webapp?

Not at any one moment did OMRS display JRE 7 on the UI. That’s what I was trying to aim at earlier in this streak. The case you mention is the default in all the tests I ran.