TOPIC A tool is typically a GUI-less application, run from the command line, that is focused on one or just a few tasks. There are a few tricks to creating a Java tool project in Project Builder; this document helps you through the process. DISCUSSION First, create your project as a WebObjects Application project type. This insures that all the required Java support is built into the project. The only frameworks that are required are the Foundation.framework and the JavaVM.framework. The only source that is required is the myWOApp_main.m file and two Java classes. Remove all other frameworks and classes not required for your project. Then set up the myWOApp_main.m file to initialize the Java virtual machine and instantiate a Java class. Here is the standard implementation:
#import <JavaVM/NSJavaVirtualMachine.h>
The Java class Tool.java has been created. In this approach, Tool.java consists only of a constructor that instantiates another Java class, ToolImplementer.java here, which does the real work of this tool. After a ToolImplementer object is instantiated, execute one of its methods to start the tool working:
import java.lang.*;
Next, create the working class. The method "executeSomething" can of course be anything you want to begin accomplishing your tool's purpose:
import java.lang.*;
Finally, create any other Java classes that you need for your tool. And that's all there is to it! |
Document Information | |
Product Area: | WebObjects |
Category: | WebObjects 4 |
Sub Category: | Development |
Copyright © 2000 Apple Computer, Inc. All rights reserved.