'Run different ActiveMQ Artemis versions with separate JDK's

quick question; is it possible and reasonable to run different Artemis ActiveMQ versions with different JDK versions? There are currently two separate Artemis-Services on my VM running different Artemis versions (2.4.0 not cool, I know :/ and 2.16.0). Now I want to upgrade the 2.16.0 to 2.21.0 which would mean, that I also need a new JDK version. The problem is I still have to provide a customer with the 2.4.0 version. Can I run the 2.21.0 with JDK 17 and the 2.4.0 still with JDK 8?

The Java-Version seems to be referenced in the artemis-service.xml as %JAVA_HOME% which is a windows environment variable and outputs either JDK 17 or JDK 8. Could I just switch this variable to a local env, similar to ARTEMIS_INSTANCE in the artemis-service.xml or is this not an intended use?

So the new artemis-service.xml would look something like this:

...
<env name="ARTEMIS_INSTANCE_ETC_URI" value="file:/C:/ApacheMQ/BROKER/etc/"/>
<env name="ARTEMIS_DATA_DIR" value="C:\ApacheMQ\BROKER\data"/>
<env name="JAVA_V17" value="C:\PATH_TO_JDK_17"/>

<logpath>C:\ApacheMQ\BROKER\log</logpath>
<logmode>roll</logmode>

<executable>%JAVA_V17%\bin\java.exe</executable>
...

Obviously one of the JDK versions wouldn't be properly installed but just residing in a folder.

Yes, I know this is more of a dirty workaround, but would it be an option in principle?



Solution 1:[1]

Your solution will works, an alternative could be to use the full path to define the executable element, i.e.

<executable>C:\PATH_TO_JDK_17\bin\java.exe</executable>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Domenico Francesco Bruscino