Compile and run BO SDK Java tool from Command Line

You can compile and run java tools without installation of IDE. You need JDK and BO SDK libraries. On BO server (with default settings), JDK can be found in

C:\Program Files (x86)\Business Objects\javasdk\bin

Batch to setup class path (env.bat)

@echo off
set libs=C:\Program Files (x86)\Business Objects\common\4.0\java\lib
set cp=%libs%/boconfig.jar
set cp=%cp%;%libs%/cecore.jar
set cp=%cp%;%libs%/celib.jar
set cp=%cp%;%libs%/cesdk.jar
set cp=%cp%;%libs%/cesession.jar
set cp=%cp%;%libs%/corbaidl.jar
set cp=%cp%;%libs%/ebus405.jar
set cp=%cp%;%libs%/javacsv.jar
set cp=%cp%;%libs%/jtools.jar
set cp=%cp%;%libs%/logging.jar
set cp=%cp%;%libs%/rebean.common.jar
set cp=%cp%;%libs%/rebean.jar
set cp=%cp%;%libs%/rebean.wi.jar
set cp=%cp%;%libs%/SL_plugins.jar
set cp=%cp%;%libs%/wilog.jar
set cp=%cp%;%libs%/external/xpp3.jar
set cp=%cp%;%libs%/external/xpp3_min.jar;
@echo on
set cp="%cp%"

Test program (Program.java)

import com.crystaldecisions.sdk.exception.SDKException;
import com.crystaldecisions.sdk.framework.*;
import com.crystaldecisions.sdk.occa.infostore.*;

public class Program {
    public static void main(String[] args) {
        IEnterpriseSession enterpriseSession = null;
        try {
            System.out.println("Connecting...");
            ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
            enterpriseSession = sessionMgr.logon("Administrator", "",
                "localhost", "secEnterprise");
            // something useful
        } catch (SDKException ex) {
            ex.printStackTrace();
        } finally {
            if (enterpriseSession != null)
                enterpriseSession.logoff();    
        }
        System.out.println("Finished!");
    }
}

Compile and run

env.bat
javac -cp %cp% Program.java
java Program

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s