Book Image

Apache OfBiz Cookbook

Book Image

Apache OfBiz Cookbook

Overview of this book

Apache Open For Business (OFBiz) is an enterprise resource planning (ERP) system that provides a common data model and an extensive set of business processes. But without proper guidance on developing performance-critical applications, it is easy to make the wrong design and technology decisions. The power and promise of Apache OFBiz is comprehensively revealed in a collection of self-contained, quick, practical recipes in this Cookbook. This book covers a range of topics from initial system setup to web application and HTML page creation, Java development, and data maintenance tasks. Focusing on a series of the most commonly performed OFBiz tasks, it provides clear, cogent, and easy-to-follow instructions designed to make the most of your OFBiz experience. Let this book be your guide to enhancing your OFBiz productivity by saving you valuable time. Written specifically to give clear and straightforward answers to the most commonly asked OFBiz questions, this compendium of OFBiz recipes will show you everything you need to know to get things done in OFBiz. Whether you are new to OFBiz or an old pro, you are sure to find many useful hints and handy tips here. Topics range from getting started to configuration and system setup, security and database management through the final stages of developing and testing new OFBiz applications.
Table of Contents (15 chapters)
Apache OFBiz Cookbook
Credits
About the Author
About the Reviewers
Preface

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.

Note

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. 1. Determine the location of the appropriate version of Java given the release of OFBiz installed.

  2. 2. Navigate to the install directory where the startup scripts are located.

  3. 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. 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. 2. Save your changes.

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