Search code examples
jakarta-eewildfly

Use custom JRE for Wildfly 10


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


Solution

  • 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.