Tutorial on Current and Future Web(NII) Technologies Java and HotJava Supercomputing 95 Monday December 4,1995 San Diego Convention Center NPAC Geoffrey Fox, Wojtek Furmanski, Marek Podgorny with Gang Cheng, Roman Markowski Syracuse University 111 College Place Syracuse NY 13244-4100 Abstract of NPAC Java/HotJava Presentatation Overview including History and the great alpha versus beta Java Mystery HotJava Features Java Features Java Programming Language Abstract Windowing Toolkit On-Line HTML Documentation Security Model Applets Programming NPAC Java Demos "Hello World" Demo WebFoil Demo including major October 95 Upgrade WebFlow Demo Software Project Manager Demo Neural Network Demo Java based Collaboratory Java based front end to Distributed Simulation Overview -- What Is Java/HotJava? HotJava is a Web browser that supports dynamically downloadable interactive content. Arbitrarily sophisticated dynamic multimedia applications inserts called Applets can be embedded in the regular HTML pages and activated on each exposure of a given page. Applet constructs are implemented in terms of a special HTML tag: where the Name points to a chunk of server side software that is to be downloaded and executed at the client side on each presentation of a page containing this applet. Applets are written in Java -- a new general purpose object-oriented programming language from Sun Microsystems. History of Java Language and Team Starts in 1991 by Project Green --- a group in Sun that detaches from the main campus as a semi-autonomous task force focused on operating software for consumer electronic devices such as smart set-top boxes Gosling (creator of Sun NeWS which had major conceptual impact both on current Java and Telescript models) realizes that C++ is not adequate and initiates development of a new language Oak, later renamed as Java. A PDA (codename *7) based on Oak/Java ready in 1993. Green Team incorporates as FirstPerson, Inc. *7 proposal to Time-Warner rejected in 1993. 3DO deal falls through in 1994. FirstPerson, Inc. dissolves. Small group (~30 people, now Java Team) continues development and decides to adapt Oak as a Web technology. History of Java Language and Team (contd) An experimental web browser written in Java, called WebRunner and later renamed as HotJava, ready in 1994. Java/HotJava published in April '95. Netscape licences Java in May '95 -- this triggers a series of other licensing agreements with major vendors and results in the current slowdown in the public releases of Java/Hotjava. Beta JDK (Java Development Kit) published in summer/fall '95. It is better software but lower functionality than Alpha. First Java books appear in fall '95 such as a popular overview by SAMS and technical book "Java!" by Tim Ritchey, edited by New Riders. Dec 4 1995 Business Week cover story on "Software Revolution --- The Web Changes Everything" exposes Java as a breakthrough force in the expanding Web/Internet. Also points out that "Java as a business" is yet to be defined. Java/HotJava Alpha vs JDK Beta When you start exploring Java world today, you need to make an upfront decision as to where to start as there are two options: Alpha or Beta, and "obviously Beta" is not so obvious --- it depends on why and how do you want to use Java in the near term. In fact, this talk, although largely Alpha-Beta independent, uses examples from the Alpha version (and so does Ritchey's book). Here is why. Alpha release of Java/Hotjava included: C source code for the Java interpreter (Virtual Machine) Java foundation classes (base language support, I/O, networking, Internet protocols, windowing, graphics, utilities) HotJava browser package used to build HotJava in Java. Includes 'hotjava' class which 'is' HotJava application. In Short, Alpha Java/HotJava was a complete software release of all system components, free for research and subject to ($125K) licence for business use. Java/HotJava Alpha vs JDK Beta (contd) Beta JDK appeared after a series licensing successes and it claims to be compatible with ongoing Java implementations by all licensees, most notably Netscape. Beta JDK includes: Java source for the foundation classes (modified and incompatible with alpha) appletviewer to run/preview applets tools for converting alpha applets to beta applets. Source code for the interpreter in absent. There is also no browser package and no beta HotJava yet --- current users are given an option to use Netscape2 or just preview beta applets using appletviewer and wait for beta HotJava (with unknown release date). The choice between Alpha and Beta depends on why and how do you want to use Java. If you want to acquire in-depth knowledge of Java and use in Browsers, start with Alpha which is a complete technology release If you just want to decorate your pages and to develop cute applets viewable by Netscape2, you must use beta as alpha is not compatible with Netscape2. Java/HotJava Alpha vs JDK Beta (contd) Warning: if you are using Alpha, don't do any serious development as you will be likely out of the mainstream soon unless you also watch Beta and monitor differences. Announcements of December 1995 clarify the medium term future but don't solve near term problems JAVA will be "open" Web standard Sun promises browser classes (beta Hot Java) soon -- then we can all compete with Netscape Netscape renames Livescript as Javascript and this is an interesting subset of Java which is fully interpreted -- use for overall customization of client Hooked on Java by Java developers Arthur van Hoff, Sami Shaio, Orca Starbuck is (first) serious (but still rather high-level) book on beta Java Several (more detailed) alpha Java books Comparison of Java and JavaScript JavaScript: Interpreted by client and NOT compiled Java: Compiled on Server before execution on client Note both are reasonably "pure" C/C++ like languages and do NOT have useful sh/awk text and system enhancements of Perl(5) JavaScript: Object based -- no classes or inheritance -- built in extensible objects Java: Object-oriented. Programs consist of object classes with inheritance JavaScript: Integrated with HTML as embedded ascii but of course HTML looks rather irrelevant at times! Java: Applets distinct from HTML but invoked from HTML Pages JavaScript: do not declare variables' datatypes -- Loose typing Java: MUST declare variables' datatypes -- Strong typing JavaScript -- Dynamic Binding -- object references computed at runtime Java -- Static Binding -- object references must exist at compile time Java and JavaScript are secure and cannot write to disk Some Key HotJava Features Document The Hot Java: A White Paper by Sun Microsystems enumerates the following main features of HotJava: Modular Browser Design Interactive Content Dynamic Types Dynamic Protocols Open and Closed Model HotJava Features -- Modular Browser Design HotJava is written in Java in a highly modular fashion Java source code used to build HotJava is collected in an integrated package called 'browser', containing ~50 classes. The browser itself is also a Java class, called 'hotjava'. Individual protocols and content handlers ("viewers") are packaged as Java classes, managed by HotJava. New protocols and/or handlers can be dynamically downloaded and automatically installed when needed. In consequence, HotJava can be easily and dynamically customized to the needs of individual users and/or applets. HotJava Features -- Interactive Content Applets can implement arbitrary interaction dynamics based on mouse/keyboard input and multimedia (graphics, sound) output. Typically, an applet will download a little simulation, mouse tracking or drawing/painting software and the interaction with the user will be handled by the Java interpreter, running at the client side. The performance and response time is therefore much higher than in client-server interaction models. Technical implementation of HotJava GUI is achieved in terms of the Abstract Windowing Toolkit which offers common, platform-independent abstraction of a generic window server (which is implemented in terms of X/UNIX, Windows/PC and Macintosh models on the individual platforms) At the moment, (alpha) Java is supported on Sun Solaris and WindowsNT platforms. Other ports are in progress. HotJava Features -- Dynamic Types and Protocols New data types (for example new video compression formats etc.) can be supported in Java even if HotJava browsers are not aware of such new formats. The data processing software needs to be packaged in terms of Java classes and provided together with the data access itself. HotJava downloads and dynamically installs the processing software first, and then proceeds with handling the data. In a similar way, the model can handle a variety of custom communication protocols, e.g. proprietary extensions of HTTP including some special security issues. The protocol handler needs to be provided as a Java package together with the protocol. It will be dynamically installed by HotJava and then used to handle the message transfer. HotJava Features -- Open and Closed Model HotJava offers a promising solution to the major software engineering problem -- retain the system open for innovation while it is at the same time closed i.e. ready for shipment and production use. This compromise is achieved by building HotJava in terms of a collection of cooperating but largely autonomous classes/modules. HotJava as of today represents one particular implementation of a Java based Web browser concept, and it leaves freedom to innovate and customize. Dedicated browsers for scientific research or K-12 education needs can easily be tailored in terms of reusable building blocks of the Java 'browser' package. This is in contrast with monolithic browsers such as Netscape which will become increasingly difficult to maintain and adapt to rapidly varying Internet trends. Some Key Java Features Document The Java: A White Paper by Sun Microsystems enumerates the following main features of Java: Simple Object-oriented Distributed Interpreted Robust Secure Architecture-neutral Portable High performance Dynamic Java Features -- It's Simple! Java omits several rarely used, poorly understood and confusing features of C++ including operator overloading, multiple inheritance and automatic pointer coercions. It adds automatic garbage collection which makes dynamic programming easier in Java than in C++. It also adds 'Interface' construct, similar to Objective C concept, which often compensates for the lack of multiple inheritance. The resulting language retains the essence of C++ but is simpler and hence easier to program in. It also results in a much smaller kernel which is suitable for planned Java ports to consumer electronic devices. Base interpreter is ~40Kb, libraries and threads add additional 175Kb. Java Features -- It's Object-oriented Java model can be viewed as a C++ subset, with some dynamic elements inherited from Objective-C (method overloading, garbage collection). The strength of Java object-oriented model is not is sophistication but in simplicity and the extensive class library associated with the system (~250 public classes). Java class plays also a role of a communication atom in the Web embedding model. Applet classes identify themselves by names in the HTML applet tag. Applet downloads other classes, present in the applet source. Hence, the Java class names play the role of addressing mode for the distributed Java code database. Java Features -- It's Distributed Popular TCP/IP based protocols such as FTP or HTTP are supported in terms of network protocol classes. This facilitates various forms of distributed processing. New protocols (e.g. PVM etc.) can added and dynamically installed. Distributed computing model of Java is mainly client-server, with Java compiler preparing the opcodes at the server side, and Java interpreter executing it at the client side. Some more dynamic forms of Java/HotJava distributed processing are being explored recently by "early adopters". For example, a distributed Pong game in which two HotJavas bounce the ball off the common Web server, or Java+MBONE based World-Wide collaboratory environment. Java Features -- It's Robust Java enforces compiler-time type checking and eliminates this way some error prone constructs of C/C++. Pointer arithmetic is fully eliminated which allows e.g. for runtime checking of array subscripts and enforces security of the Java model. Explicit declarations are always required, i.e. C-style implicit declarations are abandoned. This allows the Java complier for early error detection. Rapid prototyping in Java is less natural than in Lisp, Tcl, Smalltalk or Perl, but the software quality assurance of Java is higher than in these more dynamic and 'forgiving' languages. Java Features -- It's (Hopefully) Secure Java binaries are shipped across the network and executed on client machines. Security is therefore a critical issue and strongly enforced in Java. Modifications of the C++ model such as eliminating pointer arithmetic and coercion were dictated mainly by the security requirements. Most viruses are based on acquiring access to private/protected sectors of computer memory which is impossible in Java. Java opcodes are executed at the client side by Java interpreter which operates exclusively on the virtual memory. Hence, unless there are security bugs in the Java interpreter itself, the model is safe and users cannot create security holes by incorrectly or maliciously written applets. Java Features -- It's Architecture-Neutral C/C++ programming in a heterogeneous network environment requires use and compatibility across several vendor platforms and the corresponding compilers. This problem is solved in Java by designing platform-independent binary representation called Java bytecode (or opcode). Java compiler (written in Java and platform-independent) reads Java source and generates Java bytecode. These bytecodes are shipped to client machines upon browser requests. Each client machine must run Java interpreter which performs runtime execution of Java bytecodes. Java interpreter is written in POSIX compliant ANSI C and needs to be ported to and conventionally compiled (once) on each individual platform. Once the interpreter is ported, application developers don't need to worry at all about platform specificity and differences between native compilers. They write portable Java which is compiled by platform independent Java compiler and executed on Java interpreter, ported to various platforms. Java Features -- It's Portable Java language offers a uniform abstract machine model which is identical for all platforms. Unlike in C/C++ where various integers match the architecture of a physical machine at hand, Java byte, short, int and long are always of the same size, equal to 8, 16, 32 and 64 bits, respectively. Differences between vendor specific windowing environments (X Windows, MS Windows, Macintosh) are removed in terms of the Abstract Windowing Toolkit (AWT) metaphor. AWT is given by ~60 Java classes which offer a universal GUI programming model, portable between UNIX, PC and Mac, and translated automatically to native windowing systems on individual platforms by Java interpreters. Java Features -- It's Interpreted Java represents a compromise between fully compiled (like C/C++) and fully interpreted (like Smalltalk or Perl) models. Java "compiler" produces a binary bytecode output which is portable and much smaller than the real binary for a specific machine (Typical bytecode size is of order of the original source code, within a factor of 2). Java "interpreter" executes this bytecode and is therefore less dynamic than e.g. Perl interpreter (which performs an equivalent bytecode construction internally and on-the-fly when reading the program source). In general, the compilation process is: a) time consuming and b) platform specific. Hence, interpreters are built and used to facilitate a) rapid prototyping and/or b) portability. Java model is focused on platform independence but the development throughput is also reasonable since the Java compiler is fast and generates compact bytecode output. Java Features -- High Performance Java interpreter performs on-the-fly runtime execution of the Java bytecodes which results typically in a satisfactory performance. Support for generating native machine code out of Java bytecodes, viewed as intermediate compiler form, is also provided and useful for performance demanding applications. The performance of the machine code, generated from Java bytecodes, is comparable to that offered by typical C/C++ compilers on the same platform. Several of these concepts are in fact similar as in the OSF/ANDF project. Using ANDF terminology, we would call Java compiler a 'producer', and the machine code generator discussed here, an 'installer'. Default Java working mode doesn't use installers but directly interprets the intermediate form (this mode is supported in ANDF by GAI -- Generalized ANDF Interpreter). ANDF model is in principle applicable to all languages. Java/HotJava system implements ANDF concepts for the Java language. Java Features -- It's Multithreaded Java model offers preemptive multithreading, implemented in terms of the Thread class. Thread methods offer a set of synchronization primitives based on monitor and conditional variable paradigm by C.A.R. Hoare. Java threads inherit some features from the pioneering Cedar/Mesa System by Xerox Park that gave birth to Macintosh and object-oriented programming. A typical use of Java multithreading in applet programming is to have several independent but related simulations (e.g. various sorting algorithms), running concurrently in an applet window. Multithreading is also used internally by the HotJava browser to handle multiple document dynamics. Another interesting application domain are multi-HotJava environments to come such as collaboratory or gaming. Java threads don't have built-in point-to-point communication primitives. Various thread communication environments can be provided by coupling the thread and network protocol objects. Java Features -- It's Dynamic Java model is more dynamic that C++ and closer to Smalltalk or Perl. Subclasses don't need to to be recompiled after superclass implementation is updated. Classes have runtime representation (implemented in terms of the Class class) which allows for reliable dynamic cast and type checking operations. A class hashtable is maintained by the runtime system and allows for programmatic symbolic interfaces to class symbol tables. Class mobility and caching is not yet supported but aspects of it are likely to be available in beta version of Java expected in fall '95. The Java Programming Language This module material is based on The Java Language Specification by Sun Microsystems, Inc., March 1995. Program Structure Lexical Issues Types Classes Interfaces Packages Expressions Statements Floating Point Java Language -- Program Structure Source code of a Java program consists of one or more compilation units, implemented as files with .java extension. Each compilation unit can contain: a package statement import statements class declarations interface declarations Java compiler (called javac) reads java source and produces a set of binary bytecode files with .class extensions, one for each class declared in the source file. For example, if foo.java implements Foo and Fred classes, then "javac foo.java" will generate Foo.class and Fred.class files. Suppose that Foo implements an applet and Fred is an auxiliary class used by Foo. If HotJava encounters a tag , it will download Foo.class and Fred.class files and it will start interpreting bytecodes in Foo.class. Java Language -- Lexical Issues Lexical structure inherits a lot from C/C++. There are however some notable differences which are listed below. Java characters are based on 16--bit wide Unicode Worldwide Character Encoding rather than the usual 8--bit wide ASCII. Three types of comments are supported: // ignore all till the end of this line /* ignore all between starts */ /** an insert into an automatically generated software documentation */ Java reserves the following keywords: abstract boolean break byte byvalue case catch class const continue default do double else extends false final finally float for goto if implements import instanceof int interface long native new null package private protected public return short static super switch synchronized this threadsafe throw transient true try void while Java Language -- Variable/Expression Types Each Java variable or expression has a definite type. Simple types such as integers or booleans are built-in. New composite types can be constructed in terms of classes, arrays and interfaces. There are 4 integer types: byte, short, int, long of size 8, 16, 32 and 64 bits, respectively. Float is 32 bits, double is 64 bits. Floating point arithmetic and data formats are defined by IEEE754. Characters are given by Unicode charset and represented as short integers. Arrays are "true" or "first class" objects in Java and no pointer arithmetic is supported. Hence, arrays are handled as all other composite objects and its special role is due only to some syntactic sugar inherited from C/C++. Java Language -- Types: Array An Array is declared as: int vec[]; and created by: vec = new int[128]; or concisely: int vec[] = new int[128]; Subscripts are range checked in runtime and so vec[-1] and vec[128] will generate exceptions. Array length can be extracted via the length instance variable, e.g. int len = vec.length will assign len = 128. Arrays of arbitrary objects can be constructed, e.g. Thread myThreadList[] = new Thread[1024]; Java Language -- Classes Class declaration in Java shares common aspects with C++ but there are also some syntactic and semantic differences. Base syntax is simpler, cleaner and more intuitive. However, Java introduces some new modifiers, for example: threadsafe -- to protect variables against asynchronous modification synchronized -- to indicate that a method needs to acquire a lock before executing and to release the lock after completion native -- to declare methods implemented in a platform -- dependent language, e.g. C. final -- to mark entities that may be public but cannot be overloaded or overriden. Only single inheritance is supported but aspects of multiple inheritance can be achieved in terms of the interface construct. Interface is similar to an abstract class with all methods being abstract and with all variables being static (global). Unlike classes, interfaces can be multiply-inherited. Java Language -- Classes: An Example We illustrate essential elements of Java object-oriented programming on the following example. The following three classes are declared: Point -- a pair of floating point coordinates in a unit square Rectangle -- an ordered pair of Points Canvas -- a Rectangle with additional color information and they are all made Movable (i.e. they all implement Movable interface). Declaration of Interface Movable: public interface Movable { static float x = 0.0, y = 0.0; public void move(float dx, float dy); public void move(); } // end interface Movable Declaration of Class Point: public class Point implements Movable { float x, y; public Point(float x, float y) { this.x = x; this.y = y; } public Point() { x = Movable.x; y = Movable.y; } private float clip(float x) { if(x < 0.0) return 0.0; if(x > 1.0) return 1.0; return x; } public void move(float dx, float dy) { x = clip(x + dx); y = clip(y + dy); } public void move() { x = Movable.x; y = Movable.y; } } // end class Point Declaration of Class Rectangle: public class Rectangle implements Movable { Point p; float w, h; public Rectangle(float x1, float y1, float x2, float y2) { float xmin = min(x1,x2); xmax = max(x1,x2); float ymin = min(y1,y2); ymax = max(y1.y2); w = xmax - xmin; h = ymax - ymin; p = new Point(xmin,ymin); } public Rectangle() { w = h = 1.0; p = new Point(); } public void inverse() { float tmp = p.x; p.x = p.y; p.y tmp; } public void move(float dx, float dy) { p.move(dx,dy); } public void move() { p.move(); } } // end class Rectangle Declaration of Class Canvas: import awt.Color; import awt.Graphics; public class Canvas extends Rectangle implements Movable { Color fg, bg; public Canvas(float x1, float y1, float x2, float y2, Color fg, Color bg) { super(x1,y1,x2,y2); this.fg = fg; this.bg = bg; } public void inverse() { super.inverse(); Color tmp = fg; fb = bg; bg = tmp; } public void paint(Graphics g) { g.setColor(bg); g.fillRect(p.x, p.y, w, h); } } // end class Canvas Comments on Examples Point, Canvas, Rectangle Java methods can be overloaded (i.e. allow for multi-valued declaration with various argument patterns -- see e.g. move() method) in a similar way as class constructors. Canvas inherits move() method, and overrides inverse() method (by adding color inversion, i.e. "inverse video"). paint() method operates on Graphics object from Sun's Java class library which is included via the import statement. We used the interface construct to separate 2D translational degrees of freedoms (which are handled as Movable methods) from the internal coordinates (which are handled by individual classes). Note that interfaces can only contain static (global) variables (here, x=0.0, y=0.0 which is the default origin for Point() constructor). This allows one to avoid the usual ambiguities with multiply inherited instance variables in case of closed loops in the inheritance graph. Java Language -- Packages Classes in one or more compilation units can be grouped together and form a package. This is realized by the package statement, placed at the beginning of the compilation unit. A class Fred in package foo can be referenced by its full name foo.Fred, or by its local name Fred, after including the package import statement import foo; Packages can be nested. For example, a HTML Parser class has the following full name: net.www.html.Parser The initial alpha3 release of Java/HotJava is organized as 12 packages and it contains ~250 classes. Package Example: AWT -- Abstract Windowing Toolkit This package is at heart of visual Java programming. It has functionality (and thus also complexity) comparable to X Windows or MS Windows. AWT offers an abstraction of a platform-independent window server. The same Java windowing code will run under UNIX (implemented via X Windows) and on PCs (implemented via MS Windows). Java/AWT is the latest and the most advanced offering in the long sequence of Sun efforts to set world-wide windowing standards. Previous unsuccessful attemps were: SunView ('85) -- first UNIX windowing system. Initially successful but, proprietary and kernel based, was dominated by public, server based X Windows. NeWS ('87) -- Extended PostScript based programmable window server. More advanced than X but proprietary and more difficult to port and hence forgotten. Gosling started here! OpenLook ('90) -- compact GUI package for X by Sun + AT&T. Never made it, dominated by less elegant but more public Motif. Java On-Line HTML Documentation Java class library comes with the on-line HTML documentation Each class API is documented, including all variables, constructors and methods Variable and method types are hyperlinked to the corresponding class pages Package and class navigation buttons are provided on each page Documentation skeleton is constructed automatically from the source code. Human-made text is constructed by extracting developers comments from the source code. This is facilitated by a special comment syntax /** text */ which marks chunks of text to be included into a suitable section of the documentation page. Java/HotJava Security Model Applet bytecodes are downloaded by HotJava and executed on client machines. Security is therefore of crucial importance in the Java/HotJava model. The system implements several security measures listed below. C++ subset selected as a base model for Java does not contain explicit pointers, pointer arithmetic and uncontrolled automatic type coercion. This eliminates most viruses which are based on access to private memory areas on the client machine. There is also a multi-level runtime security system, including the following elements: A verifier that reads bytecode stream before it is passed to the interpreter and detects suspicious or dangerous constructs Class loader assures that client code is not in conflict with the system class namespace and does not perform any malicious overloading of the system classes Finally, additional protection layer is activated to check file system and network access operations. Applet Programming Applets are instances of a Java class called Applet and its subclasses. They can be embedded in HTML pages using the following tag: where MyApplet is the name of a user-developed applet class, compiled by javac into MyApplet.class and placed in the subdirectory classes vs the virtual path of the HTML page. If the HTML page has the URL address: PageURL = http://server/path/file.html then the file MyApplet.class pointed by the applet tag has the URL: AppURL = http://server/path/classes/MyApplet.class Applet Programming (Contd.) HotJava handles the tag in a similar way as , i.e. it inlines the content at the tag insertion point. Since Applet's content is Java code, this code is being downloaded and executed by the Java interpreter at the client side. Usually, applets contain some graphics and simulations which are being drawn/rendered/played on the HTML page containing the tag. Base Applet methods are as follows: init() -- called by HotJava after downloading the applet source. start() -- called whenever the user (re)enters applet's page paint() -- called on each exposure of the applet graphics area start() -- called whenever the user quits applet's page For a minimal visual applet, one needs to specify init() and paint() methods. The full content and functionality of the Applet class is listed online. NPAC Example: "Hello World" Applet This is a "Hello, World" Applet in Java: import browser.Applet; import awt.Graphics; class HelloWorldApplet extends Applet { public void init() { resize(300,50); } public void paint (Graphics g) { g.drawString("Hello World!",100,50); } } // end of HelloWorldApplet Initial (August 95) NPAC Java Demos "Hello World" -- a sequence of applets, starting from "Hello World" and gradually adding text processing functionality from other Java classes WebFoil -- The last demo in the "Hello World" sequence, illustrating components of the prototype WebFoil --- a Java/HotJava based WYSIWYG interactive foil editor WebFlow Editor -- AVS-like visual network/compute--web editor for WebWork, prototyped as a Java/HotJava applet Project Manager -- A prototype WebFlow front-end for a distributed WebWork application -- software project management on a network of WebTools servers. Neural Network -- A telelearning application with Java/HotJava interactive front end -- character drawing pad for neural network algorithm which performs hand-written character recognition. NPAC Java Demo 1: From "Hello World" to WebFoil A sequence of applets with gradually increasing complexity to illustrate various aspects of Java/Applet programming Starts with a minimal "Hello World" demo, evolves towards a prototype of the WebFoil viewer/editor/authoring tool Demo components: Minimal "Hello World" (default font size, type, color) Modifying Font Size Modifying Font Type Modifying Font Color Adding animation ("Nervous Text") Adding a control button Adding a Font Options menu Overloading HotJava MenuBar Adding mouse control (click, drag) Adding file (HTML) editor, coupled with the WYSIWYG text display and formatting panel (in progress) NPAC Java Demo 1 (cont): Using AWT from Applets Components 1--4 use only applet methods Components 5--10 extend applet functionality in terms of other classes: 5 uses threads, and 6--10 use AWT classes. Using AWT, each applet can be in fact extended to a full-blown interactive windowing application. Example: Overloading HotJava MenuBar. "item" is applet variable pointing to this applet window. Subsequent parents of this window (including the whole HotJava frame) can be extracted and customized. Hence, HotJava MenuBar can be customized and overloaded by applets (useful e.g. for developing and customizng educational browsers for various grades) NPAC Java Demo 2: WebFlow Editor Prototype Early prototype of components of an AVS-like visual compute-web editor. Two modes are supported and selected by a click on the appropriate marker in the lower bottom corner: Module placement -- a click in the active window places a new module box there Module linking -- a click on module port generates links to all other module ports with the same data type. Right now, only the front-end part is prototyped and no linkage with the backend modules is provided (see Software Manager demo for a simple backend component). The goal of the project/demo is to gradually explore Java classes in the context of the planned advanced GUI application -- WebFlow editor. NPAC Java Demo 3: Software Project Manager An early prototype of a WebWork application with WebFlow editor front-end: Software Project Manager tool. Three types of modules are supported: developers (all linked to an agent) agent (linked to developers and to the manager) manager (linked to the agent) Developers are assumed to use customized WebTools servers including CASE package for the software development. All software volume changes are monitored by the WebTools database and reported to the agent. Agent integrates and maintains the information, received from developers servers, and submits periodic status reports both to developers and to the manager. NPAC Java Demo 4: Neural Networks Example of interactive Web based telelearning "module" Backend Computation: Neural Network (Backpropagation) for hand-written character recognition Interactive Frontend Components: Java/HotJava based character drawing pad alphabet histogram to display the output layer values interactive visualization of hidden units (in progress). In the current demo, backend is a C code developed at Caltech within C3P (Felten, Hutchinson, Otto). In the "Grand Challenge" limit (as per WebWork project) this could be replaced by a suitable HPCC computation. In the "Little Simulation" limit (in progress), a simplified version of the whole backprop code can be written in Java so that the whole Neural Network "module" can be downloaded and explored at the client/student side. Recent NPAC Demos (Fall '95)-I Oracle Front-Ends -- simple Java interfaces to Oracle databases such as persdonal address book. More advanced Java/Oracle tools such as interactive calendar integrated with WebMail are at the design and prototyping stage. WebFoil "product" -- a tool for electronic presentation and Web navigation, constructed at NPAC in fall '95. "Hello World" examples illustrated early (summer '95) WebFoils concepts and components as applets. Current WebFoil product is a complete standalone alpha Java application, constructed as an extended HotJava. Content is scripted in extended HTML called FoilHTML with support for font, color and layout customization. Recent NPAC Demos (Fall '95)-II Java Collaboratory -- a skeleton environment for Web collaboratory applications. Conforms to the VRML/VAG/VRML+ model where client "avatars" are interacting with "motion servers". Here clients are implemented as applets and servers as Java applications. "Avatars" appearance is simplistic at the moment (text chat, tic-tac-toe type games). More advanced front-ends are being prototyped right now (3D virtual mall, SimLife gaming interface to NPAC HPCC simulation servers). NPAC WebFoil --- Features -I Current web browsers are often used for electronic presentation but their page formating capabilities are inferior compared with presentation packages such as Persuasion or PowerPoint. In turn, these presentation packages are previous generation software, without any scripted extensions and Web compatibility. WebFoil brings these two currently disparate worlds together, by offering a web browser which is at the same time capable of formatting and customizing foils, viewed as Web pages. Note "foil" is a good unit for electronic presentation as (can be) designed to fit a computer screen and (can) have large fonts NPAC WebFoil --- Features -II Current version NPAC WebFoil 0.1 is implemented as an extended HotJava application with enhanced page formatting and customization capabilities such as local font or color selection and margin control. Foils are edited, scripted and customized in extended HTML called FoilHTML via a set of custom attributes to be included inside the standard HTML tags. These attributes are ignored by conventional browsers and are recognized as editorial, formatting or layout instructions for the WebFoil page formatter. NPAC WebFoil -- Implementation NPAC WebFoil 0.1 is implemented as a standalone Java application (not an applet), constructed by extending HotJava version alpha3. The whole browser package from the Java/Hotjava release is overloaded by WebFoil. Technically, the browser code is copied to a separate WebFoil development/release directory and freely modified there. CLASSPATH variable is set in such a way that Java compiler thinks WebFoil browser package is the native Java browser package. All other packages, i.e. all "Java foundation classes" are left intact. As these classes form the core of the Beta release, porting WebFoil to beta Java should be straightforward after/if beta HotJava is available. Apart from modifying browser package, WebFoil also adds one more class package called 'presenter'. It includes tools such as on-line FoilHTML editor, dynamic menubar handler, foilset manager, and the attribute database manager. NPAC WebFoil --- Distribution Right now (or rather after the conference after NPAC machines are back), WebFoil 0.1 can be remotely inspected at the following URL: http://naos.npac.syr.edu:2009/cgi/webfoil[?hostname:0.0] The part in square brackets [] is optional and useful if you use X terminal. For a regular X capable UNIX workstation, your DISPLAY variable will be set automatically by the WebFoil server. You should get a large blue window with dancing applet title saying "Hello HyperWorld --- WebWindows Start Here!". That's the homepage of NPAC WebFoil server. Explore links there and enjoy. Links to the source code, minimal documentation and examples are provided on the homepage. Links to tar files with organized 0.1 release will be enabled later in December '95.