Introduction to Java and the Java Infrastructure for NetWare
Articles and Tips: article
Senior Research Engineer
Novell Systems Research
01 Jun 1996
This DevNote provides a brief overview of the Java language followed by a description of the planned Java Infrastructure for NetWare. The history of Java, its design goals and implementation are covered, followed by an introduction to Novell's Java infrastructure plans. Novell plans include a Java Virtual Machine for NetWare and Java classes that expose NDS and other services. This DevNote also includes a list of Java tools and Internet sites that provide information on Java.
- Introduction
- Java Background
- What is Java?
- Object-Oriented Development
- More on Java Bytecode and Interpreters
- Just-In-Time (JIT) Compilers
- Java2c Translator
- Java Security
- Java on NetWare
- Java Tools
- Final Thoughts
Introduction
Java is an object-oriented programming (OOP) language that has been called "the programming language for the Internet." The huge growth in the popularity of the Internet and the World Wide Web (WWW) (referred to simply as the "Web" for the remainder of this DevNote), combined with the capability to run Java applets inside Web browsers such as Netscape Navigator v.2.x, have propelled Java to the forefront of Internet development tools.
The Web has introduced the masses to the power of network computing. Traditional Web browsers, although sophisticated in their design especially with their handling of low-speed modem connections, are limited to viewing hypertext documents or static data.
The next logical step in this evolution is to provide a computing environment where application logic can be executed in and outside Web browsers that communicates with other processes running elsewhere on the network. The Java Language and other Java technologies provide this capability; they are enablers for distributed computing.
We start off with an overview of the Java language including a brief history, design goals, and the implementation. We discuss the Java Virtual Machine and the basic thought behind its cross-platform design. After reviewing the Java language, we discuss Novell's plans for implementing the Java infrastructure for NetWare. Novell's current plans for Java infrastructure consists of two parts:
The Java Virtual Machine embedded in the NetWare Operating System
Java Class Libraries that provide interfaces to NDS and other Novell services
We introduce and describe each of these technologies. We complete the DevNote with list of tools available for Java such as the Java Developer's Kit (JDK) from Sun, Caf from Symantec, and Java Workshop from SunSoft. These tools will help aspiring developers get moving with Java in short order. We also include a list of Java related Web sites where you can download some of the tools and find more Java related information.
Given the wide acceptance of Java, this DevNote is for anyone associated with the development or use of Internet and Intranet applications and services.
Java Background
The Java language was developed by Sun Microsystems starting in 1991. The original development work was part of a research project related to the development of software for consumer electronic devices. The design goals for Java required it to be small, fast, efficient, and portable.
These goals make Java the ideal language for distributing "executable" programs over the Web. Java was in the right place at the right time when it came to adapting a hot technology to fit with an area of industry experiencing incredible growth--the Internet and Web.
HotJava, a product written in months using Java, allowed for downloading and running applets over a network. HotJava was written partly to show that "real" software can be written with Java.
With the introduction of Web browsers that contain built in support of Java applets such as Netscape Navigator 2.X, a huge potential market for software written in Java already exists.
What is Java?
Java is an object oriented (OO), platform independent, multi threaded, dynamic, general purpose programming environment based loosely on C++. Java "compilers" take Java source code and generate "executables" consisting of machine independent bytecodes.
Note: Java "compilers" generate binaries consisting of bytecodes unlike the binaries created by traditional compilers that consist of native machine codes. Therefore, we place the words "compiler" and "executable" in quotes in order to differentiate throughout the DevNote between Java "compilers" and Java "executables" vs. traditional compilers and executables.
One of the design goals of Java was to achieve platform independence-the ability to execute the same code on a variety of platforms.
Java accomplishes platform independence beyond the source level. A Java "compiler" creates platform-independent bytecodes. Bytecodes are binary files that can be executed on other platforms without having to compile the source for each target platform.
These bytecodes are a set of instructions that look somewhat like machine code, but are not specific to a particular CPU. The following figure illustrates the traditional approach of a compiler.
Figure 1:The traditional compiler process.
A traditional compiler takes the source code and from this creates a machine specific binary file that contains a set of instructions particular to the target CPU. The process for creating Java "executables" is illustrated in Figure 2.
Java programs can be "executed" on any machine offering a bytecode interpreter or Java Virtual Machine. These "executables" can run unmodified on any platform that supports the Java runtime environment. The runtime environment beyond the Java Virtual Machine also includes a set of base classes which define how the program interacts with the native machine's environment.
Novell is currently integrating the Java Virtual Machine into the NetWare OS to enable the execution of Java programs on NetWare servers. The initial platforms supported for Java include: MacOS, Win '95, Windows NT, and several flavors of Unix. Other platforms will also offer Java virtual machines in the near future. IBM has recently announced significant support for Java with its support for Java on AIX with ports to OS/400, and MVS.
Figure 2:The Java "compiler" process.
Runtime environments where interpreters are used to execute bytecodes historically have suffered from lack of performance. Even though Java is multi-threaded, some of you with related backgrounds and experience are likely concerned with the potential performance of Java "executables."
Fortunately, there has been tremendous progress in the area of virtual machines over the last 20 years. Moreover, solutions are available or soon will be that promise to deliver performance at or close to native machine code for at least some segments of your Java software. We cover some of these solutions later in this DevNote.
Object-Oriented Development
If you are a software developer and you haven't looked into object-oriented (OO) development, Java is an ideal language to cut your teeth on OO development. Unlike its close neighbor C++, Java is simpler to use for a number of reasons, e.g., Java has no pointers and memory management is automatic-say goodbye and good riddance to malloc! It also uses the concept of interfaces, discussed later in the DevNote, to provide inheritance which is easier to follow than some of the inheritance schemes used in C++. Java also implements strings and arrays as real objects.
More on Java Bytecode and Interpreters
The Java Virtual Machine instruction set is designed to be small and compact in order to optimize travel across networks. "Compiled" bytecodes are stored in a .class file. One of the main tasks of the Java Virtual Machine is to provide fast, efficient execution of Java bytecodes. As we have discussed, interpreted code is never as fast as traditional compiled code. Fortunately, clever optimization techniques have evolved providing for efficient interpreted "execution" environments.
Sun has reported that current implementations of Java bytecode interpreters can perform more than 330,000 bytecodes per second; this is about 30 times slower than hardware. What about software that requires higher performance? Other alternative solutions are on the way such as just-in-time (JIT)compilers and Java2c translators.
Just-In-Time (JIT) Compilers
One of the tasks that an interpreter preforms at run time is to create a sequence of native code instructions for the specific CPU on which it is running. Just-in-time (JIT) compilers use a clever process discovered by Peter Deutsch which he called "dynamic translation." By keeping a log of instructions generated, the compiler can use the log and "peephole-optimize" the code just as a normal modern compiler does. The JIT compiler then compiles the Java source to native machine code. The end result is optimized binary code that rivals the speed of machine specific compiled code. What about simply compiling Java source in a traditional way?
Java2c Translator
A Java2c translator provides an intermediate step that makes compiling Java source to machine specific binaries possible. A Java2c translator, as the name implies, takes Java source and translates it into C that can be compiled by a native C compiler. This same method has been used with some C++ compilers.
This violates some of the original design criteria for Java; however, if you are in need of fast code for some segments of your Java development, this may be an answer. Sun has tested Java2c compilers and the results were as you would expect, performance at the speed of compiled and optimized C code-the best you can hope for.
In the future, network solutions may offer hybrid solutions that combine native machine code for CPU intensive types of algorithms and interpreters that process efficient bytecode for other portions of the overall solution.
Java Security
Security is an especially important topic when considering solutions that allow for code to be transported and "executed" anywhere on a network. The environment must provide some protections against dangerous or hostile code. We briefly discuss the security features built into Java here; however, a full discussion on the implementation of security in Java is beyond the scope of this DevNote. Look for future AppNotes and DevNotes covering the configuration of secure Java run-time environment and how to assure secure Java code.
The Java language compiler and run-time system implement several layers of defense against potentially incorrect or hostile code. The environment starts with the assumption that nothing is to be trusted, and proceeds accordingly.
The first layer of defense is the Java Language Interpreter. Memory layout is handled at run-time and not handled by the Java language compiler, as it is in C and C++. Secondly, Java does not have "pointers" in the traditional C and C++ sense of memory cells that contain the addresses of other memory cells. The Java compiled code references memory via symbolic "handles" that are resolved to real memory addresses at run time by the Java interpreter. The ability to forge pointers to memory is eliminated. Very late binding of structures to memory means that programmers can't infer the physical memory layout of a class by looking at its declaration.
By removing the C and C++ memory layout and pointer models, the Java language has eliminated the programmer's ability to get behind the scenes and manufacture pointers to memory. Experienced developers may find this limiting at first; however, given the importance of security, this should be viewed as positive.
All imported code fragments are subjected to a series of checks, starting with straightforward tests that verify that the format of the code is correct followed by a series of consistency checks by the Bytecode Verifier.
After incoming code has been determined clean by the bytecode verifier, The Class Verifier provides additional security. A Java program may request that a particular class or set of classes be loaded, possibly from across the network. Java classes are separated into "namespaces" or "realms" based on where they are located. The Class Verifier subjects classes loaded from across the network to tighter security requirements.
For example, classes loaded from a "less protected" namespace cannot replace a class from a "more protected" realm. This assures that an imported class cannot "spoof" a built-in class. Since local classes include access to the things such as the file system's I/O primitives, this kind of protection is crucial.
The Class Verifier also assures that built-in classes can never accidentally reference classes in imported name spaces-they can only reference such classes explicitly.
These and other access restrictions err on the conservative side, which makes constructing some very useful extensions impossible or awkward. Java has a mechanism whereby public keys can be securely attached to code fragments that allows code with trusted public keys to have fewer restrictions.
We touched only briefly on the subject of security. A secure environment requires technologies and procedures outside the scope of a development language. Secure systems require a "holistic" approach including physical security, firewall protection, access control, etc.. The Java language provides mechanisms that insure security at the development level.
Java on NetWare
Novell, with its huge installed base of millions of servers, represents an unparalleled opportunity for software developers utilizing Java. Applet development can now be augmented with the development of netlets-server-based Java programs. In support of your efforts to capitalize on this next wave in computing, Novell is currently developing the Java infrastructure for NetWare.
Bringing Java to the Novell platform consists of two parts:
The Java Virtual Machine embedded in the NetWare Operating System
Java Class Libraries that provide interfaces to NDS and other Novell services
Novell and independent software vendors (ISV) can ride the wave of popularity that Java currently enjoys. The installed base of NetWare servers provides a significant opportunity for developers to create the server side of the network solution.
See page 69 for information on the NetWare Software Development Kit for the Java Platform.
The Java Virtual Machine on NetWare
The key ingredient in bringing Java to NetWare is to create a Java Virtual Machine for NetWare. A prototype of this system was demonstrated at BrainShare in March of 1996. This will allow for Java applets and applications to be "executed" on NetWare.
Java Classes with Interfaces to NetWare Services
Novell is currently constructing class libraries in Java that will allow you to create Java solutions that utilize Novell services such and Novell Directory Services (NDS). NDS and other Novell services will expose methods or interfaces in Java classes. This will provide for relatively easy leverage of NDS with Java applications.
Novell is providing other technologies to complement the three main efforts. For example, Novell is also committed to providing a debug environment with support for remote debugging. Novell is also exploring support of a server graphical user interface (GUI) that supports the Abstract Windowing Toolkit (AWT) classes in Java. Additionally, Novell is looking at the implementation of a security model for Java program execution on the server.
Java Tools
Many of you may want to get started with Java. The following sections provide a list of vendors and tools they offer related to Java. Descriptions and locations for downloading are provided to assist you in getting started.
Sun
At the time this DevNote was written, May of 1996, the Java Development Kit (JDK) current release is JDK 1.0.2. and is available from Sun with the following contents:
Java Applet Upgrade Utility
Java Applet Viewer
Java Debugger API and Prototype Debugger
Java Compiler
Java Interpreter
The 1.0.2 JDK is available on these platforms:
SPARC Solaris (2.3 or later)
Intel x86 Solaris
Windows NT/95 (Intel x86)
Macintosh 7.5
For downloading and for more details, see:
http://java.sun.com/devcorner.html
SunSoft
SunSoft has a toolset called the Java Workshop. It contains a project manager, source editor, build manager, Debugger, source browser, applet tester, and portfolio manager. Java Workshop was written entirely in Java.
http://www.sun.com/developer-products/
Symantec
Symantec's Caf is the first integrated development environment for the development of Java applets and applications. Caf integrates Sun's Java Development Kit (JDK) 1.0 into Symantec's fully integrated development environment (IDE)for Windows 95 and Windows NT.
Caf provides a fully featured project management system, GUI source level graphical debugger in addition to sophisticated editing and browsing tools. Visit their site:
Borland
Borland C++ 5.0 and the Borland C++ 5.0 Development Suite include a number of Java development tools. The Java tools are incorporated into the Borland C++ 5.0 Integrated Development Environment (IDE); you not only can develop powerful Java applications, but you can create mixed Java and C++ projects as well. Borland's Java tools feature complete support for developing both Java applets and applications.
This includes project management support, access to Java compiler and debugger options through the IDE's multi page dialog boxes, color syntax highlighting for Java source code, a code generation expert, and a graphical debugger.
If you purchase the Borland C++ 5.0 Development Suite, you will also receive a copy of the AppAccelerator, their Just In Time compiler for Java. The AppAccelerator can increase the performance of Java applications by an order of magnitude.
Borland is also building a high-performance, visual, rapid application development (RAD) environment for creating Java applications. The product, code named Latte, will be developed in Java. Borland has committed to deliver Latte technology in several stages with the first commercial release scheduled to ship in the first half of 1996. Visit Borland's Web site at
IBM
IBM has been working on Java implementations since Summer 1995 and has a heavy investment in Java, having ported to OS/2 and AIX and with ports to OS/400, MVS and Windows 3.1 in progress. To obtain the current versions of the JDK, visit the site:
http://ncc.hursley.ibm.com/javainfo/
To receive announcements on porting status visit the site:
http://majordomo.hursley.ibm.com/majordomo/listsavail.html
A technology demonstration of a Java enabled browser for OS/2 is available at the site:
http://www.raleigh.ibm.com/WebExplorer/
Metrowerks
For those interested in the Macintosh OS, Metrowerks is offering support for Java development with the new release of CodeWarrior v9.0. Visit Metrowerks' Web site at:
Novell
Stay tuned to Novell's plans for Java in future DevNotes and check out our Web sites:
http://www.java.novell.com/ http://www.novell.com/ http://developernet.novell.com/
Final Thoughts
Java, with it's already significant industry support, provides a significant opportunity for software developers to create solutions that will run on a large number of machines. Java provides, perhaps, the most level playing field for software developers seen in the past decade.
Ultimately the success of Java and NetWare will depend on people like you, our readers. The Net is crying out for a new kind of programming and Java is the most likely candidate to succeed. If you're interested in getting into the Internet/intranet "gold rush" from a developer point of view, Java should be first on your list as a potential delivery vehicle.
To get started, visit some of the sites listed above. Some of the tools have sample versions available for download. Some tools such as Symantec's Caf provide a full integrated development (IDE) that makes that first "hello world" applet a quick and easy process.
* Originally published in Novell AppNotes
Disclaimer
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.