Electric Communities: E Programming Language 

Getting Started with E

This chapter introduces the concepts essential to understanding the E Extensions to Java. It also describes how to download E, and compile and run E programs.

The features summarized in this chapter are explained in more technical detail in the E Runtime chapter. Also, see the Glossary for descriptions of E terms.

What is E?

E is set of extensions to Java designed for writing distributed applications including databases, groupware, publishing systems, multimedia, and games. E is built on the Java Virtual Machine, and requires an existing operational and installed Java Development Kit (JDK).

E classes are very similar to Java classes, and the two can coexist in the same program. However, E provides some powerful enhancements to Java, including:

Distributed communication

E's messaging facility provides a robust and transparent distributed communications model that is much more flexible and secure than other programming languages. For example, in some languages, if different nodes on a network need to communicate, you must explicitly include the addresses of those nodes and their communications protocols in the code. E, on the other hand, takes care of this for you.

An E-object can send a message to any other E-object, even if the other object is on a different machine on the network; the objects do not need to know anything about underlying network protocols.

E's transparent messaging feature makes it easy for a programmer to automatically establish connections between objects without having to deal directly with network access details. And the underlying access framework is not changed; it is still accessible to the programmer if necessary.

Capability semantics

The E extensions use a security model called capability semantics. This model is based on a very simple idea: object A can only access object B if it is passed a reference to B by something else that already has access to B. This type of reference is called a capability-it is a reference to an object that lets you perform some otherwise restricted action.

E's security model is quite different from Java's. Java's security model is based on an all-or-nothing approach: it assumes that all code originating on the local hard disk is trusted, and all code originating from the network is not trusted. Based on this model, Java provides system security by checking the stack each time a potentially dangerous method is invoked. If no untrusted class is on the stack, the method is allowed to execute.

E, on the other hand, lets you selectively assign privileges. "Trustedness" is granted in as much or as little detail as you choose. In E, you maintain security by restricting an object to sending only specific messages to other specific objects. It is impossible for an object to send an unauthorized message. Once the capability to reference an object or send a message has been granted, no further run-time check is required. You do not need to rely on third-party security mechanisms to assign privileges for your application.

For example, consider a word processing application program running within an E-secured environment. In E, you can restrict the application to only prompt for a file through a dialog box. This dialog would then return a capability which gives access to that file alone; the word processing program would not be able to touch any other user file. You could restrict this application even further; for example, letting it edit only those files created on a certain date.

Optimistic computation

Optimistic computation is a methodology that helps prevent long delays when communicating across a network. E implements this with its asynchronous messaging model, deferring statements, and channels.

E-objects always communicate by sending messages to one another. All E messages are unidirectional and asynchronous. When one object sends a message to another requesting a value, the requesting object does not need to stop computing and wait for a response. Instead, E provides statements to "defer" the requesting code block until the value is furnished, and allow the rest of the program to continue executing. The requesting object can continue to operate "optimistically", as if it already has the answer it needs.

When an object sends a message requesting a value to another object, it includes a channel as one of the message parameters. A channel is a conduit E-object that carries messages from one object to another E-object, and acts as a placeholder for any requested values that the recipient E-object may reveal to the sending object.

Trust management

In a networked world, users will want to download and run software from outside sources. To maintain system and application security in such an environment, E provides a Trust Manager. The Trust Manager does the following:

These mechanisms help prohibit the spread of viruses or Trojan horses that may damage or "embezzle" user data.

To help you create and manage trust relationships among objects, E provides a user interface called the Class Blesser. You can invoke the Class Blesser through either a graphical or command-line interface.

For more information on E's trust management system, see the Authentication section in the E Runtime chapter. For information on the Class Blesser, see Appendix A, E Tools and Utilities.

Other features provided by E

In addition to the features described in the previous paragraphs, E provides the following:

See the E Runtime chapter for descriptions of these features.

How to obtain and install E

You can download the E extensions from either of the following:

To install E, follow the instructions from the online README.TXT file. From the online sites, you can also obtain the E documentation, both in HTML and Postscript format. Be sure to also read the online RELEASE.TXT file for any last minute updates.

You must have Java 1.0 already installed and running in order to use E. To obtain Java 1.0, download it from the JavaSoft web site, http://java.sun.com.

Creating, compiling, and running an E program

The process of building and running E applications is almost identical to Java, since E is built on Java. What distinguishes E code from Java code is its functionality and purpose.

The E extensions, by definition, are more suited for creating secure, stand-alone applications running on distributed systems. While it is possible to create simple applets and local applications in E, generally there is no great advantage to writing these in E versus Java. Indeed, Java code can be more efficient for these types of applications. See the section Using Java and E code together in the E Runtime chapter for more information.

To implement E features, E provides its own classes and keywords. For a description of the E keywords, see the E Language Specification chapter. For a description of classes, methods, and interfaces provided by E, see the E Class Library chapter.

Regardless of whether you use E or Java code to create an application, however, you can run your program in the E runtime, since E is completely backwards-compatible with Java.

For examples of E programs, see the E Language Tutorial, and also the examples in the online E examples directory (in your downloaded version of E).

How to create an E program

Creating an E program is just like creating a Java program. You use a standard text editor to create a source file, which you then compile into Java bytecodes, and then run through a Java interpreter provided by E.

Like Java, an E program is enclosed in a class definition, and the program body is contained in a routine called main, which is the first piece of code run in your program. An E program can contain both Java and E code. For example:

  public class HelloE
    public static void main(String args[])
      <HelloWorld code>


For guidelines on using E and Java code in the same program, see the section the section Using Java and E code together in the E Runtime chapter.

By convention, E source files have a .e suffix instead of .java, although this is not required.

This manual assumes you are already familiar with creating programs in Java, and therefore does not describe how to do this. For information on how to create Java programs, see the JavaSoft documentation.

How to compile an E program

After you create an E application, you compile it using the ecomp E compiler. Like its Java counterpart, javac, ecomp compiles E and Java code into Java bytecode. For example:

  ecomp HelloE.e

For information on this compiler, see Appendix A, E Tools and Utilities.

How to run an E program

You run an E .class file just as you do in Java, but with the javaec E Java interpreter. For example:

  javaec HelloE

For information on running this command, see Appendix A, E Tools and Utilities.

Naming conventions

This section describes the naming conventions used for E objects, E expressions, and EARLs (E Absolute Reference Locator).

Objects created with E have capabilities different from ordinary Java objects. Because of these differences, this manual refers to such objects as E-objects, and their methods as E-methods, to distinguish them from conventional Java objects and methods. Similarly, E has E-interfaces, E-exceptions, and E-classes, which, while similar to their Java counterparts, implement additional E functionality. See the Glossary for descriptions of these terms.

Class Names

By convention, the names of E runtime classes (those that are descended from E's EObject rather than Java's Object class) begin with a capital E. This prefix distinguishes these E classes from Java classes; for example, EBoolean is distinguished from Java's Boolean class.

Ordinary Java classes (those that are descended from Java's Object class) that are part of the E runtime environment, but are not E classes, generally have names that begin with Rt, as in RtEnvelope.

See the E Class Library chapter for descriptions of these classes.


Keywords that are unique to the E language begin with a lowercase letter "e", as in the eif statement. Many of these keywords are similar to their Java counterparts.

See the E Language Specification chapter for descriptions and examples of the E keywords.

EARL (E Absolute Reference Locator)

An EARL is the E equivalent to a Universal Resource Locator (URL), and references an E-object. Like a URL, an EARL is designated in terms of an abstract descriptor, which is registered in a directory with the server responsible for interpreting that EARL.


E-objects register themselves in the directory by sending messages to the directory services object. Each node in the name hierarchy has an associated capability that is necessary for registering an object in it. (There are also capabilities for unregistering, adding branches to the hierarchy, and so forth.)

Copyright (c) 1996 Electric Communities. All rights reserved worldwide.
Most recent update: 7/19/96