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.

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.ibm.com/java/jdk/download/index.html. 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 VisualAge for Java, 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. To see a list of JAR files that contain the classes provided by Able, look in the product bin directory (for example, C:\able1_1a\bin)or browse a script such as C:\able1_1a\bin\runnit.bat. Jars shipped with Able version 1.1a are here.

The Java development tools we use are:

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.

    [Graphic shows the Main Class file com.ibm.able.examples.ablebean.AbleFileWatcher.]
  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.

    [Graphic shows the Input class files consisting of the directory also specified for Output class files and required bin/runnit.bat jar files.]
  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.

    [Graphic shows the directory chosen to write Output files, which is also listed as the first directory in Input class files.]

  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.
    [Graphic shows the Source files directory, the root directory for your package source.]


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

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 1.1a are:

%ABLE_HOME%\lib\ableall.jar;%ABLE_HOME%\lib\antlr.jar;%ABLE_HOME%\lib\archiveaccessor.jar;%ABLE_HOME%\lib\jcchart361J.jar;%ABLE_HOME%\lib\JLog.jar;%ABLE_HOME%\lib\xerces.jar;  

Depending on the version of the Java Virtual Machine you use, you may need to include some Java files as well; for example, Java 1.1 users will need to include both classes.zip and swingall.jar. The following examples show appropriate values for various Java Virtual Machine versions; note that beginning with Able version1.1a, JDK 1.2.2 or later is required:

 
Environment variable JDK 1.3 or 1.2  
PATH c:\jdk1.3.sun\bin;c:\winnt\system32;c:\winnt  
ABLE_HOME (if set) C:\able1_1a  
CLASSPATH not defined  
CLASSPATH with Able 1.1ajars %ABLE_HOME%\lib\ableall.jar;%ABLE_HOME%\lib\antlr.jar;%ABLE_HOME%\lib\archiveaccessor.jar;%ABLE_HOME%\lib\jcchart361J.jar;%ABLE_HOME%\lib\JLog.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:

Linux and Windows 2000 will be included in the near future.

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:

Example Environment Settings

Example environment settings are as follows in a Windows environment:

C:\able1_1a\bin>set CLASSPATH
Environment variable CLASSPATH not defined

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

C:\able1_1a\bin>set ABLE_HOME
ABLE_HOME=C:\able1_1a

C:\able1_1a\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:\able1_1a\bin>runnit

C:\able1_1a\bin>java -classpath
".;C:\able1_1a\lib\ableall.jar;C:\able1_1a\lib\antlr.jar;
C:\able1_1a\lib\archiveaccessor.jar;C:\able1_1a\lib\JLog.jar;
C:\able1_1a\lib\jcchart361J.jar;C:\able1_1a\lib\xerces.jar"
-Dable.home="C:\able1_1a" -Dable.prefdir="C:\able1_1a"
com.ibm.able.editor.AbleEditor

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

Loading core ABLE beans from
C:\able1_1a\lib\ablebeans.jar
adding AbleRuleSet
adding AbleNeuralPredictionAgent
adding AbleGeneticSearchAgent
adding AbleExport
adding AbleImport
adding AbleBackPropagation
adding AbleSelfOrganizingMap
adding AbleFilter
adding AbleNeuralClassifierAgent
adding AbleDefaultAgent
adding AbleNeuralClusteringAgent
Loading example ABLE beans from
C:\able1_1a\lib\ableexamples.jar
adding SimpleAbleBean
adding SampleSensorEffector
adding SimpleAbleAgent

C:\able1_1a\bin>