Installing Java

Before getting started developing an application the developer must ensure that he/she is going to develop an application by using the best tools.

Installing Java

Before getting started developing an application the developer must ensure that he/she is going to develop an application by using the best tools.

Installing Java

Installing Java

     

Before getting started developing an application the developer must ensure that he/she is going to develop an application by using the best tools. The combination of two features Platform Independent and Object Oriented makes the java powerful to build the flexible application. In old days it was difficult to develop the flexible applications by using the conventional toolsets, java made it easy.

Due to the global utilization of java language, new tools are being developed daily and are providing the user friendly tools to develop the flexible and powerful application that are easy to use. Daily development of new tools are making the application easy but on the other hand they are creating much confusion to the java developers. Some of them are illustrated below:

  • What is the necessity to develop a new Java application?
  • What browser the required to run my applet?
  • What tools are to be used to develop a java application?
  • Is there any requirement to purchase the GUI development tools (such as Microsoft Jakarta, Borland Latte, Symantec Cafe)?
  • What is require to run my applet by my clients at their end?

Here we are trying to answer of all these questions as well as provide the tools to develop the java application.

Let's start with the Java Development Kit: Sun Microsystems made some standards as open to gain comments and suggestions at public level for the improvement and advancement of the java language. To support Sun Solaris operating systems and 32-bit Windows (Windows 95 and Windows NT) Sun provided the implementation of the Java Virtual Machine. Sun also provided the basic tools needed for java programming. JDK contains all the to tools to develop a java application or an applet. JDK contains the sample application, a compiler, an interpreter, a debugger and an appletviewer to test your code. As a beginner, we consider that neither you don't have the java development kit nor the knowledge about the installation of JDK on your machine. So let's start from the ground level,

This link provides you the information about the latest version of the JDK. Just by clicking the link ensure that your computer have the latest version of the JDK otherwise download the latest version of the JDK from  JavaSoft website. you have three choice to download the jdk for the following operating systems:

  1. Microsoft Windows 95 and Windows NT
  2. Apple Macintosh 7.5
  3. Sun Solaris 2.3, 2.4, 2.5 on SPARC-based machines or  Solaris 2.5 on x86-based machines.

The order may be different of the above three options on the site.

We can get the JDK by FTP from ftp.javasoft.com. Choices of all of the operating system are available, and the JDK can be found in the \pub directory. Availability of JDK for all these operating systems means that the Sun made some enhancement in JVM  and deployment tools to support all these operating systems. It is nothing for the browsers vendors this means that they must provides some hooks to display the java applet within their windows. Now the time is about to come when java will running on everything from cellular phone to mainframe.

JDK Installation: JDK installation instruction varies from platform to platform. So on the basis of the instruction we divided the JDK installation into three parts depending on the platform such as Windows, Solaris and Macintosh.

A good question arises here "If java is cross platform then for each platform why we need to download the separate files". So the answer is that the source file once compiled can run on any platform provided the JVM should be installed. But the key point is that the Java Developer Kit contains a no of executive files (such as Compiler,  Interpreter,  Debugger and so on) that are compiled specific to a platform. While the source code (.java files)  are similar to Windows as well as Solaris.

JDK Installation on Sun Solaris: 

  1. First check if you have the tarred version of  JDK and then unpack the file before use just by giving the following command.
    /usr/bin/zcat JDK-1_0_2-solaris2-sparc.tar.Z | tar xf -
    But you should here notice that the file is the correct file name (as the latest version may have some changes in the name) of the file JDK-1_0_2-solaris2-sparc.tar.Z
  2. A directory /java will be created after installation. Don't forget to include the java/bin to the class path. This directory contains all the tools required to build any applications.

JDK Installation on Windows 95 and Windows NT: 

  1. To create a main directory that will contain all the downloaded file run the self extracting file JDK-1_0_2-win32-x86.exe.
  2. Add the directory \java\bin to the class path.
    For Windows 95: You can do it by editing the path variable in your AUTOEXE.BAT file then restart the system to affect the changes.
    For Windows NT: Edit the environment variable path in the Control Panel "System" application.

JDK installation on Apple Macintosh system 7.5:

  1. First unpack the downloaded file JDK-1.0.2-MacOS.sea.hqx or JDK-1.0.2-MacOS.sea.bin. If the downloaded file is in hqx format then to decompress this file use DeHQX or BinHex4. Use Stuffit to decompress the file, if the file is in MacBinary format.
  2. To create a folder named JDK-1.0.2-mac run the installation program.
  3. It is not required to set the environment variable as there are a number of environment variables the JDK uses to compile the class. Some of them are illustrated here:
  • JAVA_HOME - This variable is used to store the root directory 
  • PATH - The previously installed instructions will help you to set the path variable correctly. 
  • CLASSPATH - This variable is used to store the directory location of addition class files that are used to compile the project. On PC it is separated by the semi-colons while on UNIX colon is used to separate the list.
    Don't unzip the classes.zip file without updating the CLASSPATH variable.

Testing the installation: Run the sample application included with the JDK by using the appletviewer application. This application is located in the \bin directory of the installation. JDK and the tools included with it are command line. To run the applet viewer in Windows 95 and Windows NT just go to the DOS prompt and go through the following steps.

  • If you installed the JDK into the c:\ java directory then change it to \demo\ fractal directory just by typing the following command.
    cd demo \ fractal
  • The applet viewer can suppose an .html file as input that contains a Java applet.

Exploring the java Developer's kit: The tools included in the JDK are contained in various directories. Some directories are illustrated below that contains the most widely tools used to develop the java application.

bin\  directory : The bin\  directory contains the following tools.

  • Compiler (javac)  :   This is the compiler used to compile the source (.java files) and produces the .class file after compilation.
  • Interpreter (java) :   This is the interpreter and is used to run the stand alone Java application.
  • Debugger (jdb)   :   This is called line tool and is used for debugging. It is the command line tool.
  • Appletviewer  :   This tool is used to test the java applets.
  • JavaDoc   :  This tool is used to generate the documentation for a java application.

demo\  directory : This directory contains a large number of applets that are useful to understand "what exactly the applets are and how they are developed?"

Animator GraphLayout
ArcTest ImageMap
Blink MoleculeViewer
BarChart JumpingBox
Clock SimpleGraph
CardTest NervousText
DrawTest SpreadSheet
DitherTest SortDemo
Fractal TicTacToe
GraphicsTest WireFrame

include\  directory : This directory contains the a set of C and C++ header files. Java classes use these files just to make the interface to C and C++ language.

lib\ directory : This directory contains the classes.zip as the primary file. This is the combination of all the classes that together make up the JDK. Primary packages in this directory are:

  • java.lang : This package is mostly used and contains the language functionality.
  • java.util : This is the utility package that contains a number of useful functions.
  • java.io : This is the input/output package and support all the java input/output operations.
  • java.net : Networking package support all the networking related operations.
  • java.applet : This package works as the base class for all the applets.
  • java.awt : This package supports for all the GUI based applications.

rc\ directory : This directory contains all the source files used by JDK. It will not be visible for the Windows 95/NT users. But they can restore it by unzipping the src.zip file from the root directory of JDK.

Distributing the Java Virtual Machine: When the most user think about java, they think about the Java applet but java is not limited to only applet. stand alone applications can be made in java by using JDK. Windows 95/NT setup requires the following files:

 java.exe
javaw.exe
javai.dll
classes.zip
awt.dll
net.dll
jpeg.dll
mmedia
mfc30.dll
msvcrt20.dll

Other Development Environment:
Now Software developers have become habitual to work with the fully graphical environments. The tools such as Microsoft Visual Basic, Borland Delphi, Powerbuilder, and Powersoft,  known as Rapid application development made easy to use and increased the programmer productivity. Then Java came in the market. In the beginning JDK was designed to run virtually on any platform which have the Java Virtual Machine and to work as a basic development toolkit. Whole of the industry getting benefits with the more powerful java tools.Microsoft, Sun, Symantec, and Borland are the manufacturers of the most anticipated tools. Java development can be done on every operating system that are available today.

Summary: The necessary tools required to development a java application, are available in the Java Developer's kit (JDK). Nowadays a wide range of platforms support the Java Development tools.