## Setting Up Your Java Environment

Setting up your Java environment consists of these steps:

1. Obtaining and installing a Java virtual machine
2. Obtaining and configuring a Java development tool
3. Defining environment variables
4. and, frequently, debugging environmental problems such as verifying the Java virtual machine version and comparing your environment's settings to example environment settings.

Here is a list of jars provided with Able, a dependancy diagram, and their purposes:

Jar name | Development and Runtime | Source | Use
ablebeans.jar | Development and Runtime | Able team | 'core' beans and agents
able.jar | Development and Runtime | Able team | base classes and data
ablegui.jar | Development | Able team | Agent, filter, rule editor; bean customizers
ableexamples.jar | Development | Able team | com.ibm.able.examples package
ableplatform.jar | Development and Runtime | Able team | support for distributable FIPA-defined agents
ablerules.jar | Development and Runtime | Able team | rules package
ableui.jar | Development | Able team | Eclipse/Websphere plug-in tooling
ablex.jar | Development and Runtime | Able team | extensions and prototype beans and agents
amablogic.jar | Development and Runtime | Able team | buyer/seller strategies for conversational agents
antlr.jar | Development and Runtime | antlr.org | required by rule editor and runtime for parsing Able Rule Language source
archiveaccessor.jar | Development | IBM alphaWorks | Agent editor uses to add/remove serialized agents to/from jars
jas.jar | Development and runtime | SourceForge | Java Agent Services
jcchart361j.jar | Development | KLG JChart | Agent editor inspector graphing utilities
jikesbt.jar | Development and runtime | Jikes compiler | Required when ARL rulesets define inner classes
rt.jar | Development and runtime | JDK jre\lib directory | Required when ARL rulesets define inner classes
GFCall.jar | Development | IBM alphaWorks | Graph Foundation Classes used for conversational agents
JLog.jar | Development | IBM alphaWorks | log.jar from Logging Toolkit for Java
xerces.jar | Development and Runtime | apache.org | or IBM alphaWorks XML parser for Java ("xml4j")
bsf.jar | Development and Runtime | Bean Scripting Framework | Bean Scripting Framework opensource project, used for AbleJavaScriptAgent
js.jar | Runtime | Netscape RhinoScript | AbleJavaScriptAgent

We do not distribute any database specific JDBC jars such as db2java.zip. We once distributed an example for CommonRules but ARL 1.3's Java support made it obsolete. We have a prototype Java Management Extensions (JMX) Dynamic Mbean which requires TMX4J.

Able is shipped as undocumented API's with OS/400 V5R2 in the /QIBM/ProdData/OS400/able directory. The initial release corresponds to Able 1.3c.

### Obtain and Install a Java Virtual Machine

Java virtual machines are included in Java Development Kits (JDKs) that are downloadable from the Worldwide Web as well as distributed with various Java development tools and textbooks. You can obtain JDK's built by Sun at http://java.sun.com/j2se/ and by IBM at http://www-106.ibm.com/developerworks/java/jdk/ or IBM's Internal Java Centre at http://w3.hursley.ibm.com/java/. Follow the installation instructions provided at those sites.

### Configuring a Java Development Tool

Java development tools such as the Gnu Java Development Environment, IBM's Websphere, Inprise JBuilder, Symantec VisualCafe, and SilverStream provide edit and debug capabilities that improve programmer productivity. Configuring these tools is best left to their own setup instructions. Refer to the above list of JAR files that contain the classes provided by Able, look in the product bin directory (for example, C:\able_1.5.0\bin)or browse a script such as C:\able_1.5.0\bin\runnit.bat.

The Java development tools we use are:

- Websphere tooling based on Eclipse 2.0
- Gnu Java Development Environment

In the past we have used:

- Inprise JBuilder 3.0 and 4.0
- Symantec Visual Cafe 3.0

Here are the steps needed to configure a project in VisualCafe Version 3.0, assuming a root working directory of C:\ableWorkDir\able,and a package of com.ibm.able.examples.ablebean:

1. Go to the Project menu pulldown, and select Options. Enter the name of a class with a main, such as your Bean's customizer if it has one or com.ibm.able.editor.AbleEditor for the AbleEditor.
2. Click on the Directories tab, and list the directories and jar files which will be included in your CLASSPATH by VisCafe when compiling your project for the Input class files. Make the first directory the entry you also supply for Output files; other entries should include the jar files listed in bin/runnit.bat.
3. Select Output class files from the combobox on the Directories tab to provide the directory where the compiler is to save the class files it generates; note that this directory should be the first entry included in the Input class files as well.
4. Select Source files from the combobox on the Directories tab to provide the directory where the debugger is to locate your source files, your project's source root directory. In this case we choose to keep source .java files and compiled .class files in the same directory.

### Defining Environment Variables

There are three environment variables used to define the Able and Java environment. The scripts provided with Able such as runnit.bat calculate and set these variables from the starting directory. The Windows .bat scripts work only on English machines as is.

If you are not using a script provided with Able or you have a non-English Windows system, you will need to define and set the following environment variables either in your command window or in your Java development tool. Java development tools may have their own procedure for setting these values rather than relying on system environment variables.

PATH is the environment variable that contains the path used to find the executable file for the Java virtual machine.

ABLE_HOME is the product directory and is used to calculate the Able.ProductDirectory property. Set this environment variable to the path where you installed Able, such as C:\able1_1b.

CLASSPATH provides the path to classes for loaded by the Java Virtual Machine. Scripts provided with Able prepend any existing CLASSPATH settings with the appropriate jar files and directory paths. If you are developing your own beans and agents, browse the appropriate script to see which jar files and directories to include in your own CLASSPATH. Able jar files are located in the product directory's lib subdirectory. Jar files required by Able are best determined by looking at the startup script in the bin directory that corresponds to whether you wish platform beans included (runPlatform.xxx) or not (runnt.xxx).

The following examples show appropriate values for various Java Virtual Machine versions; note that beginning with Able version1.2a, JDK 1.3 is required:

Environment variable | JDK 1.3 |
PATH | c:\jdk1.3\bin;c:\winnt\system32;c:\winnt |
ABLE_HOME (if set) | C:\able_1.5.0 |
CLASSPATH | not defined |
CLASSPATH with Able 1.5jars |
     %ABLE_HOME%\lib\able.jar;%ABLE_HOME%\lib\ablebeans.jar;%ABLE_HOME%\lib\ableexamples.jar;%ABLE_HOME%\lib\ablegui.jar;%ABLE_HOME%\lib\ablerules.jar;%ABLE_HOME%\lib\ablex.jar;%ABLE_HOME%\lib\antlr.jar;%ABLE_HOME%\lib\archiveaccessor.jar;%ABLE_HOME%\lib\bsf.jar;%ABLE_HOME%\lib\jcchart361J.jar;%ABLE_HOME%\lib\jikesbt.jar;%ABLE_HOME%\lib\JLog.jar;%ABLE_HOME%\lib\js.jar;%ABLE_HOME%\lib\xerces.jar;

### Debugging Environmental Problems

The core developers of Able use a variety of platforms for code and debug, and can provide limited assistance on basic Java knowledge and in development environments. Our preferred communication mechanism is the Able discussion forum on IBM Alphaworks at http://www.alphaworks.ibm.com/tech/able. You may also e-mail us at ableinfo@us.ibm.com.

The operating systems with which we are familiar include:

- AIX
- Windows 2000/NT/98/95
- OS/2
- Linux

Should you need individual assistance with your Java environment, please provide the following information:

1. Operating system name and version
2. CLASSPATH environment setting
3. PATH environment setting
4. ABLE_HOME environment setting
5. Java virtual machine, ie, output from java -version
6. Console output from runnit.bat

#### Verifying the Java Virtual Machine Version

To see what version of Java you are using, type the following at a command prompt:

>     java -version

The Java virtual machines used at the time this document was written include:

- IBM JDK 1.3, for development and build
- Sun JDK 1.3

#### Example Environment Settings

Example environment settings are as follows in a Windows environment:

>     C:\able_1.5.0\bin>set CLASSPATH
>     Environment variable CLASSPATH not defined

>     C:\able_1.5.0\bin>set PATH
>     Path=c:\jdk1.3.sun\bin;c:\winnt\system32;c:\winnt
>     PATHEXT=.COM;.EXE;.BAT;.CMD

>     C:\able_1.5.0\bin>set ABLE_HOME
>     ABLE_HOME=C:\able_1.5.0

>     C:\able_1.5.0\bin>java -version
>     java version "1.3.0" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
>     Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

>     C:\able_1.4.1\bin>runnit
>      Directory of C:\able_1.4.1

>     C:\able_1.4.1\bin>java -classpath ".;C:\able_1.4.1\lib\able.jar;C:\able_1.4.1\li
>     b\ablebeans.jar;C:\able_1.4.1\lib\ableexamples.jar;C:\able_1.4.1\lib\ablegui.jar
>     ;C:\able_1.4.1\lib\ablerules.jar;C:\able_1.4.1\lib\ablex.jar;C:\able_1.4.1\lib\a
>     ntlr.jar;C:\able_1.4.1\lib\archiveaccessor.jar;C:\able_1.4.1\lib\autotune.jar;C:
>     \able_1.4.1\lib\bsf.jar;C:\able_1.4.1\lib\jcchart361J.jar;C:\able_1.4.1\lib\jike
>     sbt.jar;C:\able_1.4.1\lib\JLog.jar;C:\able_1.4.1\lib\js.jar;C:\able_1.4.1\lib\xe
>     rces.jar;" -Dable.home="C:\able_1.4.1" -Dable.prefdir="C:\able_1.4.1\.." com.ibm
>     .able.editor.AbleEditor

>     Licensed Materials - Property of IBM
>     Package: com.ibm.able
>     (C) Copyright IBM Corporation 1999, 2003. All Rights Reserved.
>     US Government Users Restricted Rights - Use, duplication or
>     disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

>     Loading ABLE core from jar C:\able_1.4.1\lib\able.jar
>     adding AbleDefaultAgent
>     Loading ABLE rules from jar C:\able_1.4.1\lib\ablerules.jar
>     adding AbleRuleSet
>     Loading ABLE beans from jar C:\able_1.4.1\lib\ablebeans.jar
>     adding AbleFilter
>     adding Fuzzy2WayLoadBalanceController
>     adding AbleRuleAgent
>     adding TestAutotuneAdaptor
>     adding AbleGeneticSearchAgent
>     adding AbleImport
>     adding AutotuneAgent
>     adding AbleTemporalDifferenceLearning
>     adding AbleBackPropagation
>     adding AbleRadialBasisFunctionNet
>     adding BasicNeuralAutotuneController
>     adding AbleNaiveBayes
>     adding AbleExport
>     adding AbleNeuralClassifierAgent
>     Loading ABLE extensions from jar C:\able_1.4.1\lib\ablex.jar
>     adding AbleKnnClassifierAgent
>     adding AbleNaiveBayes<2>
>     adding AbleDecisionTree<2>
>     adding AbleNaiveBayesClassifierAgent
>     adding AbleDecisionTreeClassifierAgent
>     adding AbleScriptAgent
>     adding AbleJavaScriptAgent
>     adding AbleKnn
>     Loading ABLE platform agents from jar C:\able_1.4.1\lib\ableplatform.jar

>     Loading ABLE gui beans from jar C:\able_1.4.1\lib\ablegui.jar
>     adding DefaultDecisionMaker

>     Loading ABLE example beans from jar C:\able_1.4.1\lib\ableexamples.jar