The JAVA_HOME setting

OFBiz startup scripts must invoke the Java executable as part of its initiation process. If you are using one of the provided startup scripts and you can't start up OFBiz because the Java executable cannot be found (you will get an immediate error to this effect), you can easily add the necessary statement to the script to indicate the location of the Java executable.

Tip

Note: The scripts as they are distributed today assume that you have previously set the JAVA_HOME environment variable using your computer's environment variable setting tools to the location of the Java runtime executable. This setting should be in the environment prior to invoking the OFBiz startup script. If this location has not been set or has been set incorrectly, you will not be able to start up OFBiz.

Getting ready

To set up JAVA_HOME, you need to first perform the following steps:

  1. Determine the location of the appropriate version of Java given the release of OFBiz installed.
  2. Navigate to the install directory where the startup scripts are located.
  3. Open up the appropriate startup script (startofbiz.bat for Windows or startofbiz.sh for Unix).

How to do it...

JAVA_HOME can be set up in the following way:

  1. Add a line similar to the following prior to the comment line "location of java executables" as shown in the following snippet from the Unix startofbiz.sh startup script shown here:
    # This is an example of setting the JAVA_HOME variable in the
    # UNIX startofbiz.sh script:
    JAVA_HOME=/bin/java
    export JAVA_HOME
    # location of java executables
    if [ -f "$JAVA_HOME/bin/java" ]; then
    JAVA="$JAVA_HOME/bin/java"
    else
    JAVA=java
    fi
    
  2. Save your changes.
  3. Restart OFBiz using the modified startup script.

How it works...

The JAVA_HOME environment variable sets the location of the Java executable relative to the hard drive and the file system of the host operating system so that the startup scripts know where to find it. In this way, you could have many Java versions installed on your computer and still tell OFBiz which installed version to use at any point in time.

Out-of-the-box OFBiz assumes that the JAVA_HOME variable has been set prior to the invocation of the startup script. As an alternative to modifying startup scripts, you may also set JAVA_HOME from the command line prior to invoking the startup script.

There's more...

If you are starting up OFBiz from the command line and not using the startup scripts, you should set your JAVA_HOME prior to invoking OFBiz. For example, if your Java executable is located in the /opt/java directory (folder for Windows readers), and you are running a Unix system, then set the JAVA_HOME environment variable as follows:


JAVA_HOME=/opt/java
export $JAVA_HOME
java jar ofbiz.jar
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.82.217