Use custom JRE for Wildfly 10

2019-07-10 04:47发布

问题:

Can I choose a custom JRE for a Wildfly Application Server with a property like standalone.bat -Djava.jre=<path>

For my project, it is important that I can't change the value of parameter JAVA_HOME

回答1:

You can set the JAVA_HOME used by WildFly.

For Linux/UNIX, check the standalone.conf file:

# Specify the location of the Java home directory.  If set then $JAVA will
# be defined to $JAVA_HOME/bin/java, else $JAVA will be "java".
#
#JAVA_HOME="/opt/java/jdk"

For Windows, check the standalone.conf.bat file:

rem #
rem # Specify the location of the Java home directory (it is recommended that
rem # this always be set). If set, then "%JAVA_HOME%\bin\java" will be used as
rem # the Java VM executable; otherwise, "%JAVA%" will be used (see below).
rem #
rem set "JAVA_HOME=C:\opt\jdk1.6.0_23"

Simply uncomment the line that sets the JAVA_HOME variable and update its value with the desired path.



回答2:

You might run

JAVA_HOME=/path/to/Java bin/standalone.sh

Or the Windows variant of it. This is similar to change the standalone start script. The JAVA_HOME variable will take only effect to the started process. Every other open shell window will see the original JAVA_HOME