Bookmark this page:
[ Delicious Delicious ] [ Mister Wong Mister Wong ] [ Stumble It! ]

Contents

Icon
Obba Tips and Troubleshooting

Troubleshooting

The Obba log window.

Debugging Sheets: Using the Log Window

Obba can generate extensive diagnostic output. You can access its log window via Obba Control Panel: Windows: Show Log Window. Here you find details which objects where created under which label and which objects were accessed.

Object handle not found.

The most common mistake when using Obba functional calls is to pass a literal value where an object handle is expected. See "Passing Literals" in the Obba documentation.

Using Obba from VBA

Adding a reference to Obba in order to use the Obba functions from VBA.

Although Obba allows to create Java enabled sheets without any glue code, you can of course use Obba from VBA.

Setting up your VBA: Adding a reference to Obba

To use Obba from VBA you have first add a reference to Obba:
  1. Load Obba.xla if it is not already loaded.
  2. Open Visual Basic Editor from your Excel Workbook.
  3. Make a reference to Obba by selecting Tools -> References... (see Screenshoot).
  4. You may now use the Obba functions in VBA.

Example

The following VBA code uses instantiates a java.util.Date object and calls toString on it to print the current date in cell A1:
Sub Test()  Dim dateHandle As String
 Dim dateStringHandle As String
 Dim dateStringValue As String

 dateHandle = obMake("myDate", "java.util.Date")
 dateStringHandle = obCall("myDateString", dateObject, "toString")
 dateStringValue = obGet(dateString)

 Range("A1").Value = dateStringValue
End Sub

Migrating Obba-Enabled Sheets

Migrating Obba-Enabled Sheets from Excel to OpenOffice

  1. Save your Excel file in xls format.
  2. Open the Excel file (.xls edited with Excel) in OpenOffice.
  3. All calls to Obba will start with #NAME! (because the name of the Obba for Excel add-in is not mapped to the Obba for OpenOffice add-in).
  4. Open the "Find & Replace" dialog (Command-F) and enter the following values:
  5. Save the file in odt format.

Migrating Obba-Enabled Sheets from OpenOffice to Excel

  1. Save your file with OpenOffice in xls format.
  2. Open the OpenOffice file (.xls edited with OpenOffice) in Excel.
  3. All calls to Obba will perform correctly, but the cell shows #NAME (because the function is not recognized as being associated with the Obba for Excel Add-In).
  4. For all sheets:
    Open the "Replace..." dialog (Ctrl-H) and enter the following values: Note: Replacing "=" with "=" does not change anything in the sheet, but formulas will be reinterpreted. As a result, the Obba function calls will be associated with the "Obba for Excel" add-in.
  5. Save the file in xls format.

Changing the Java Runtime Environment (JRE) / Setting the JRE Parameters

Java Runtime Settings under Windows 2000.

Setup of the Java Runtime Environment for Obba for Excel

Obba for Excel uses the Java Plugin JRE (i.e. the one used by Browser Applets). Open the Java Control Panel. Select the "Java" tab, then choose to "View..." the Java Applet Runtime Settings. There you can specify the JRE and its startup parameters.

Setup of the Java Runtime Environment for Obba for OpenOffice

OpenOffice has its own Java setup. Open OpenOffice Preferences/Options and select the Java tap. There you can chose the JRE and assign its startup parameters.

Setting the Java Runtime Policy

If libraries used through Obba need certain access rights (e.g. for a network connection), you must ensure that the Java runtime used by Obba has the appropriate rights (java.policy). There are several alternatives: See also Default Policy Implementation and Policy File Syntax.

Location and name of the policy file

Note: java.home refers to the value of the system property named "java.home", which specifies the directory that houses the runtime environment - either the jre directory in the Java 2 SDK or the top-level directory of the Java 2 Runtime Environment.

Windows

On Windows the system wide policy file for the system JRE is java.home\lib\security\java.policy.

The user specific policy file is .java.policy and located in %USERPROFILE%.

Creating a New Policy File in Your %USERPROFILE% Folder

If you do not have a .java.policy file in your %USERPROFILE% folder, then you can create one. If Windows does not let you create the file (since it filename has to start with a dot), then copy the file from the ZIP archive below to your %USERPROFILE%.

Unix / Obba for OpenOffice

On Unix the system wide policy file for the system JRE is java.home/lib/security/java.policy. On Mac OS X the system wide policy file for the system JRE is java.policy and located in /Library/Java/Home/lib/security/.

The user specific policy file is .java.policy and located in $HOME.

Adding an Additional Policy File

If you want to add an additional policy file having a different name or in a different folder, then you need to add the following argument to the JRE: -Djava.security.policy=someURL where someURL is the path to the policy file (using /, not the backslash).

Example

To allow socket network connections add the following to your policy file:

grant {
  permission java.net.SocketPermission "*", "connect,accept";
};
(Note: It may be advisable to add a restriction to the codebase).

Enabling Java logging to a file

Obba uses the standard java.util.logging.Logger. By default logging is enabled. The java default is to send log output to the console.

To enable logging to a file edit the file $JAVA_HOME/lib/logging.properties (on Mac OS X this is /Library/Java/Home/lib/logging.properties) and use a line like

handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler

By default, the log file will be created in your home directory.

To view the log file you a log viewer like Java Log Viewer may come in handy.