Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

The BeanBox: Sun's JavaBeans test container

Learn how to use this valuable testing tool

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
The BeanBox, from Sun, eases the development of JavaBeans by providing a test container for the components. The BeanBox can test that the code you wrote for your bean works properly inside a container. This article, a companion piece to my current JavaWorld article, "Double Shot, Half Decaf, Skinny Latte: Customize your Java," teaches you the ins and outs of using the BeanBox.

Downloading and installing the BeanBox

Downloading and installing the BeanBox is the easiest part. The BeanBox is a part of Sun's free Beans Development Kit (BDK). While it's possible to write beans without the BDK, the documents, sample code, JAR files, and, of course, the BeanBox all make bean development much easier.

Download the BeanBox from the Sun Web site at http://splash.javasoft.com/beans/bdk_download.html. You can also download the BDK via FTP from ftp://splash.javasoft.com/pub/bdk_jun97.exe for Windows/x86, and ftp://splash.javasoft.com/pub/bdk_jun97.sh for Solaris/Sparc and Solaris/x86.

The program you download will install the BeanBox on your system. Be sure to refer to the instructions on the download page.

Running the BeanBox

To run the BeanBox from the command line, change directories to the directory in which you installed the BDK. (From now on, we'll call this the "BDK directory.") Then switch to the beanbox subdirectory. This directory contains two files, run.sh (for Unix) and run.bat (for Windows). Running the batch file appropriate for your operating system will start the BeanBox.

If you're a Windows user, you can create a batch file called BEANBOX.BAT and place the following lines in it:

@echo off
cd BDK-directory\beanbox
run.bat


(Be sure to replace BDK-directory with the name of the BDK-directory.) Users of Windows 95 or Windows NT can even create a shortcut to this batch file, and run the BeanBox by simply clicking the shortcut's icon.

Upon running the BeanBox, a small window will appear, saying Loading and analyzing jars....

Loading JARs

At this point, the BeanBox is reading the JAR files in the jars subdirectory of the BDK-directory. A JAR file is a ZIP archive file containing class files (including beans), GIF files, and other resource files the classes may need, plus an optional manifest containing structured information describing the contents of the JAR. You can create your own JAR files and put them in the jars directory, and the BeanBox will include them in the ToolBox. See Resources below for links to finding out more about JAR files.

After a few moments, the small JAR file window disappears, to be replaced by three windows, as seen in the figure below:

The BeanBox windows

These three windows are:

  • On the left, the ToolBox. This window contains all of the beans that are available for adding to the BeanBox.
  • In the middle, the BeanBox. This window contains the beans we're working on.
  • On the right, the Property Sheet. This window contains property editors for all of the properties of the currently selected bean. (In Figure 2, the currently selected bean is the BeanBox itself, as evidenced by the crosshatched box around the perimeter of the BeanBox.)


The BeanBox currently is in design mode, meaning that you can select beans from the ToolBox, place them on the BeanBox, change their properties by using the Property Sheet, and manipulate their behavior with the items on the menu across the top of the BeanBox.

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comment
Login
Forgot your account info?
Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources