The Java Development Environment

Buy Shoes Online
 Java Development Enviroment  




  The Java Developer's Kit provides you with four basic tools that help you write, compile, debug, test, and run Java code. These tools are the Java compiler, the Java interpreter, the Java debugger, and the Java AppletViewer. Java's other tools, such as the Java API documentation generator (javadoc), the Java disassembler (javap), and the Java header and stub file creator (javah) are included in the JDK. The Java tools, combined with Java libraries of utility classes and methods, form the complete Java system.

The following section describes the basic Java tools that you will use and explains how they are useful.

Your Text Editor

You can write your Java source code using any standard text editor, such as Notepad, Write, or Edit for Windows NT/95 users and TextEdit for Solaris users. A variety of text editors more suitable for development can be found on the Internet. You might want to use a text editor that comes with a development application, such as Visual C++. Java source code is generally saved with the extension .java.

The Java Compiler

Your Java source code can be compiled using javac, the Java compiler. It compiles source code into bytecode for the interpreter to execute. Compiled Java code is automatically given the extension .class by the compiler.

One important change that the Java team made from C was in compiling. C is a compiled language. It outputs binary machine code, which can be run only on the machine for which it is compiled. Compiled C code executes quickly, but it is architecture-dependent. As stated before, one of the important features of Java is that it is architecture-neutral. Java accomplishes architecture independence by splitting the compiling function across two tools: the Java compiler and the Java interpreter. The Java compiler outputs bytecode, similar to machine code but written for the Java virtual machine, which doesn't exist. The interpreter verifies this bytecode, converts it into machine code of the hardware platform it is installed on, and executes it. Source code must only be written for one machine: the virtual machine. The interpreter takes care of the rest. Therefore, the Java language is both compiled and interpreted.

The Java Interpreter

Java's interpreter is called java. It converts the bytecode output from the javac compiler to machine code and executes it.

Java is unlike purely interpreted languages, which generally interpret source code before execution, sacrificing performance. Another important feature of Java that Sun boasts is high performance. Execution by Java's interpreter is near to the speed of binary executables produced by compiled languages. The reason for this is that Java code is compiled to an intermediate stage where the file is still architecture-neutral, but close enough to machine code that it can run efficiently. In addition, Java's multithreading feature can improve performance by moving interpreter operation to the background.

In addition to architecture-independence, the other advantage of using the Java interpreter is security. The interpreter can evaluate classes to ensure that the bytecodes being interpreted do not violate any language constraints or perform illegal activities on the system or memory. This can prevent many viruses from spreading.

The interpreter runs outside the browsing environment. It provides the programmer with the ability to run stand-alone applications that have nothing to do with the Internet but that are portable and platform-independent.

The Java Debugger

You can debug your code using the Java debugger, called jdb. It helps you find and fix bugs in Java code.

The Java debugger provides a command-line debugging environment for Java programs. Debugging can be done on a local or remote Java interpreter.

The Java AppletViewer

You can test your applets using the Java applet viewer, called AppletViewer. It provides a programmer with a way of testing applets outside of a full-blown Web browser.

Although Netscape Navigator has Java functionality and can be used to view applets, its security features prevent it from loading applets from the local drive. It also doesn't have the networking capabilities of the Java AppletViewer. Therefore, the AppletViewer is the best tool for full applet capability.





Copyright Manjor Inc.