Hi,

I have several custom Karaf builds requiring Java 8, but the most resent one 
requires Java 17.
To avoid switching JAVA_HOME on every machine I resorted to attaching the 
required Java version number in the environment variables e.g., JAVA_HOME_17.
Within the Karaf build the file setenv is modified to the correct JAVA_HOME 
version e.g., SET JAVA_HOME=%JAVA_HOME_17%
This works well until the service wrapper gets installed, displayed below a 
part of the Windows 11 wrapper.conf.
set.default.JAVA_HOME is set correctly, but further below %JAVA_HOME% points to 
the default JAVA_HOME in my environment settings, giving Java 8 exceptions on 
startup.
Resetting JAVA_HOME to point to the JDK 17 resolves the issues, but then 
clashes with older builds.

What are the possibilities to propagate the setenv into all wrapper references?

#********************************************************************
# Wrapper Properties
#********************************************************************
set.default.JAVA_HOME=C:\Program Files\Eclipse Adoptium\jdk-17.0.6.10-hotspot
set.default.KARAF_HOME=C:\Users\betzm\Downloads\runtime
set.default.KARAF_BASE=C:\Users\betzm\Downloads\runtime
set.default.KARAF_DATA=C:\Users\betzm\Downloads\runtime\data
set.default.KARAF_ETC=C:\Users\betzm\Downloads\runtime\etc
set.default.KARAF_LOG=C:\Users\betzm\Downloads\runtime\data\log
set.default.KARAF_VERSION=4.4.3
set.default.PATH_WITH_JAVA=%JAVA_HOME%%WRAPPER_FILE_SEPARATOR%bin%WRAPPER_PATH_SEPARATOR%%PATH%%WRAPPER_FILE_SEPARATOR%.

# Include JAVA_HOME/bin in the default PATH variable
set.PATH=%PATH_WITH_JAVA%

set.JDK_JAVA_OPTIONS=--add-reads=java.xml=java.logging 
--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED 
--patch-module 
java.base=%KARAF_HOME%/lib/endorsed/org.apache.karaf.specs.locator-%KARAF_VERSION%.jar
 --patch-module 
java.xml=%KARAF_HOME%/lib/endorsed/org.apache.karaf.specs.java.xml-%KARAF_VERSION%.jar
 --add-opens java.base/java.security=ALL-UNNAMED --add-opens 
java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED 
--add-opens java.base/java.util=ALL-UNNAMED --add-opens 
java.naming/javax.naming.spi=ALL-UNNAMED --add-opens 
java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED 
--add-exports=java.base/sun.net.www.protocol.file=ALL-UNNAMED 
--add-exports=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED 
--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED 
--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED 
--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED 
--add-exports=java.base/sun.net.www.content.text=ALL-UNNAMED 
--add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED 
--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED 
--add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED 
--add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED

# Java Application
wrapper.working.dir=%KARAF_BASE%
wrapper.java.command=%JAVA_HOME%/bin/java
wrapper.java.mainclass=org.apache.karaf.wrapper.internal.service.Main
wrapper.java.classpath.1=%KARAF_BASE%/lib/boot/*.jar
wrapper.java.classpath.2=%KARAF_BASE%/lib/jdk9plus/*.jar
wrapper.java.classpath.3=%KARAF_BASE%/lib/wrapper/*.jar
wrapper.java.library.path.1=%KARAF_BASE%/lib/wrapper/

Met vriendelijke groet / Mit freundlichen Grüßen / Kind regards,
Maurice Betzel
Principal Software Engineer - Gaston Schul Group


Al onze verrichtingen geschieden op basis van de Algemene voorwaarden der 
Expediteurs van België, gepubliceerd in de bijlage tot het Belgisch Staatsblad 
dd. 24 juni 2005 onder nr. 0090237. De tekst van deze voorwaarden wordt op uw 
verzoek gratis toegezonden.
All our transactions are subject to the General Conditions of the Belgian 
Forwarders Association which have been published under nr. 0090237 in the 
"Bijlage tot het Belgisch Staatsblad" dated June 24th, 2005, and is available 
free of charge upon request.
Toutes nos opérations se font sur base des Conditions Générales des Expéditeurs 
de Belgique. Le texte en a été publié dans l' Annexe au Moniteur Belge du 24 
juin 2005 sous le n° 0090237. Ce texte sera vous envoyé gratuitment sur demande.
Email confidentiality notice:
This email and any files transmitted with it are confidential and intended only 
for the use of the recipient. If you have received this email in error please 
notify its sender.

Reply via email to