Java Reference
In-Depth Information
If you are using Ant (and why wouldn't you be?) you will need to put the
path to the J2EE JAR in the classpath which Ant uses. Since Ant can define its
own classpath, you may want to define your compile task as something like this:
<target name="compile" >
<javac srcdir="${src}"
destdir="${build}"
classpath="/usr/local/SUNWappserver/lib/j2ee.jar:${stdpath}" />
</target>
Now it's a simple matter to compile. The basic Java compile command:
$ javac com/jadol/budgetpro/*.java
will compile all the various classes and interfaces that make up the EJB. There
may be other classes in your source tree that need to be compiled as well. With
all that going on, you can see why so many people use Ant. With the compile
target defined as in our example above, you would need only the command:
$ ant compile
22.3
R EVIEW
There are many pieces involved in the construction of an EJB. Besides writing
the session bean implementation, there are the remote and home interfaces to
be written. The local and local home interfaces are optional, but useful, espe-
cially in cases where arguments cannot be serialized or where you know that
the beans and the client will reside on the same host. Compiling an EJB is not
different from any other Java compile, but it requires a special JAR in your
classpath, one that contains the definitions of the J2EE objects and interfaces.
22.4
W HAT Y OU S TILL D ON ' T K NOW
We still haven't shown you how to deploy the EJB, now that you have one
compiled. In the next chapter we'll show you how to assemble the pieces of the
EJB into an Enterprise Archive and then deploy and run it.
More importantly, though, we haven't covered how to write the code for
stateful session beans or entity beans. Stateful session beans are one-to-a-client-
session, rather than taking all comers, so there is a little more to code, and a
Search WWH ::




Custom Search