Packages Can Provide In Java Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Fig 4: Shows how program runs in the Java Platform

The above figure shows how actually the program runs on the Java platform. And it also shows that the Java API and Java Virtual Machine shield the program from the Hardware- Based Platform. The code which is compiled on the specific hardware platform is known as Native Code. And after compiling it, the compiled code runs on the specific hardware platform. When it is considered with the platform-independent environment, the platform containing java is little bit slower than the native code. But due to well tuned interpreters, smart compilers and just-in-time byte code compilers increases the performance of the java platform as close to native code without harming the portability or without threatening the portability.

What can Java Technology Do?

Applets and Applications are the two main and the most common programs written in java programming language [16]. First, we shall see what actually the applets means is in Java programming language.

Applet is a program written in a java programming language and it is stick to or adheres to firm to limited number of conventions which helps it to run in the java enabled browser. Java programming language is not considered only for writing code for entertaining applets on the web but even it is used for the general purpose as it is a high level programming language it can be used to develop in many software platforms. We can write as many programs in java using the API.

Now we shall discuss about the applications in the java programming language.

Applications are the one which runs directly on the java platform and it is a standalone program. Server it is a special kind of application in the network which servers and supports the clients. Some of the examples for Server are proxy servers, web servers, print servers and mail servers.

Servlets is one of the specialized programs. Servlets are the one which runs on the server side and it can be also thought as applet. In order to build a interactive web applications and for replacing the use of CGI the Java Servlets are one of the popular choice.

Servlets are almost same as applets but here it works in the applications which are having run time extensions. In configuring the server, java web servers and also in tailoring the server the Servlets runs on. With the packages of software components the API supports these kinds of programs which provide the huge range of functionality. Some of the features provide by the Java platform which having full implementations are as follows:

Applets: Applets will be using the set of conventions.

The essentials: Numbers, data structures, date and time, objects and so on.

Internationalization: This will help for the world-wide users by writing the programs in appropriate language and also these programs can be adapt to the locales automatically.

Networking: Internet Protocol addresses (IP), URLs, User Data gram protocol (UDP) and Transmission Control Protocol (TCP).

Java Database Connectivity: To the range if relational databases, it will give uniform access [17].

Software Components: For the existing component architectures it can be plugged in and it is also known as JavaBeans.

Security: Access Control, Public and Private key Management, provides security in both low level and high level, also provides security in electronic signatures and certificates.

Object Serialization: Communication through RMI (Remote Method Invocation) and allows lightweight persistence.

Including all the above the Java platforms also have the Application Programming Interface (API) for servers collaboration, 2D and 3D graphics, animation, speech, accessibility and so on.

Java IDE

"Javac" Java Compiler

Tools (Other Devices)

Java Debugger

Plug-in Java

Client Compiler
























Win 32


SDK 1.3 Default JRE 1.3

Fig 5: Show components included in Java Software Development Kit

The above figure shows what all the things included in the Java SDK.

Java Technology helps in the following ways:

It will help to Write Fewer Codes: Java helps us to write less code when it is compared with the same program which is written in C++ language. It will be almost 4 times less than the program which is written in C++. And some of the metrics which is are compared between C++ and java is Method count, Class counts and so on.

It will help to Write Better Codes: Good programming practices and the garbage collection in the java programming language helps in minimizing memory leaks and encourages to write better codes. And it also main features which can be easily carried like its wide-ranging, its object orientation and its JavaBeans architecture helps other people to reuse it wherever they wanted with the help of java platform. With the Help of its API, other people codes can be easily tested and can debug errors.

It will help to get start quickly: As it is an object oriented programming, it is very easy to learn for programmers who actually know C or C++. As Java programming language is very similar to C and C++ languages.

Programs can develop more quickly: As we will be writing fewer lines of code and it is simpler when it is compared with C++ programming language. Hence the development time in writing the program takes very less time than the C++ programming language. Hence the programs can develop more quickly than in C++.

Using pure Java, the platform dependencies can be avoided: By using the java the use of platform dependencies can be reduced by 100%. Due to this, the libraries which are used to write the programs in other language can be reduced.

Software can be distributed more easily: Applets can be upgraded from the central server easily. Without recompiling the entire program the new feature or the new classes can be load successfully.

Write once, Run anywhere: The programs which are written in pure java programming language are compiled in to the byte codes which are completely machine-independent and on java platform this will run consistently [18].

Open Database Connectivity (ODBC):

For application Developers and database system providers, the Microsoft Open Database Connectivity acts as one of the standard programming interface. Before the arrival of ODBC, programmers using different appropriate languages for each database they were connecting but later on ODBC have become the default for windows programs. From the coding perspective, the data base system is almost irrelevant due to the choice of ODBC. ODBC has made the programmers or application developers to think much more than the syntax, because it will hectic to change from one database to another when there is need of sudden changes due to some business need.

Due to the presence of Open Database Connectivity in the control panel, it can be easy to specify the appropriate database which is actually associated with the data source in which the ODBC application program is written. Let us just think if the name of the ODBC data source is written on the door then it will be easy to recognize to which database it is actually belongs to. Just for a reference, the data source which is named as Accounts payable data belongs to the Access Database where as sales figures belongs to the SQL server database. Any database can be resided on the LAN in which the data source should be referred to it.

ODBC uses the file called ODBCINST.DLL when it is installed in the control panel. Using a stand-alone program called ODBCADM.EXE it is possible to administer the ODBC data sources in the system. There are list of ODBC data sources are available in the system. And the data sources are depends on the type of version on the system. There are two types of versions are available one is 16 bit and another one is 32 bit. Depends on these two versions separate list of ODBC data sources are available. Despite of the database vendor, the ODBC application functional calls can be used as same to interface with any data source. For example the source code of ODBC doesn't change when it is used with either Oracle or SQL. There are many dozens of database systems are available and for dozen of database system ODBC drivers are available for it. Many documents can be converted in to data sources for example even the plain text files, excel sheets and many can convert in to data sources. In order to detect which driver is necessary to deal with the data sources the ODBC administrator uses the Registry Information from the operating system and with the help of that it will detect which ODBC low-level driver is needed. The ODBC can handle all the network issues in the client and server environment for the application programmer.

Even having many advantages in the ODBC but before it is having some issues or disadvantages in the ODBC. The ODBC is not much efficient in interacting with the database interfaces which are even native. Due to many detractors it was making it too slow for the ODBC to interact with the Database. Even the Microsoft has some issues with the quality of the drivers used in the system. Even they were claiming it many times about the quality in the driver software. But it has improved in the recent times and the availability of the better quality of driver software for the ODBC has been improved when it is compared before. But the criticism is almost parallel to the criticism in which many were complaining that the compiler doesn't work as much faster or it doesn't match with the speed of the Assemble language. Either the compiler or the ODBC may not work faster but it will help to write the code cleaner and this will help to finish it off at the earliest. In the interim, as the year goes the computer becomes faster.

Java Database Connectivity (JDBC)

Java Database connectivity was developed by Sun micro systems. And this is developed in order to establish the API standard independent database for java [46]. For the variety of RDBMSs, the JDBC provides a consistent interface for generic SQL access mechanism [19]. Using the drivers or plug-in database connectivity modules the consistent interface can be achieved by the JDBC. In order to get a JDBC support for a database vendor, then the one should provide the driver for the necessary platform in which actually the database should work or the java should run on.

As we discussed earlier in this chapter, ODBC has wider range of acceptance in many platforms. So to get the JDBC to accept in wider range then the basing should be done from JDBC on ODBC. When basing JDBC on ODBC the new drivers can reach the markets more effectively and at the faster speed because it will take less amount of time to develop completely new solution for JDBC. Because of this basing now the JDBC has a wider acceptance.

JDBC was released in the year 1996 in the month of March and left for trial for 90 days. In these 90 days all the reviews from the public are recorded and the trial ended in month of June 1996. After considering all the reviews from the public JDBC v1.0 has been published thereafter.

JDBC Goals

Many packages of software were built without intension of any goals. In many software packages JDBC is one of them. Because the JDBC has many goals due to this it leads to the development of the Application Programming Interface. With this development and with the feedback from the reviewer, the JDBC class library has been finalized and this leads to the solid framework for construction of the database applications in Java. There are nearly eight goals which give you the information about how the classes and the functionalities will behave and why they have been designed.

The eight goals of JDBC are as follows:

SQL Level API:

Defining the SQL interface for java was one of the main goal were the designers felt. The SQL interface was not the lowest database interface, but it will help the higher-level tools to be at very low level and it is also helped in creating the APIs. And at the same time it is at the high enough level which gives confident to the higher programmers to use it. After attaining this condition it will generate the JDBC code for the newer or future vendors and also helps the users by hiding the complexities of the JDBC.


Depending on the database vendor the syntax of the JDBC changes. Due to this the JDBC support the database vendors by allowing the users to pass the query statement to get the required information from the underlying database drivers. By this the JDBC helps in analyzing the non-standard functionality and also helps in handling it, as it is required by the users

On the top of the database interfaces the JDBC should be implemented

Always on the top of the SQL level APIs, the JDBC SQL API must be placed because it will help of the software interfaces; the JDBC uses the existing ODBC level drivers. And also the software interfaces helps in translating the ODBC to JDBC and vice versa.

Rest of the Java system should provide the consistent Java Interface

The designers feel that the Java's acceptance in the user community is very high, so the core of the current Java system and the current system should not be lost.

Keep it Simple

This goal suits for the entire environment and this is one of the important goal in any designing of the software. And while designing the JDBC they have considered this as one of the main goal. While designing the JDBC the sun mainly concentrated on the design and made it to complete a task per mechanism. And for the users of the API it allows the duplicate functionality only to confuse the users.

Keep the Cases simple

The most common cases like SELECT, INSERT, UPDATE and DELETE are the most common and usual SQL calls and the programmers wants these should not be changed and in the JDBC the same queries should follow and it should be simple to perform [19]. With the simple SQL queries even the more complex SQL queries are also possible to perform in the JDBC. So with help of java networking, the sun micro systems started to proceed for the implementation. And for each and every updates in the cache table, it is necessary to for MS Access database for dynamic updating.

Machine code instructions is the another name for Java byte codes in which we can consider java byte codes as a machine code instruction for Java Virtual Machine. The Java Virtual Machine acts as an implementer for Java development tool kit or a web browser which runs the Java applets [20]. This will be implemented in each and every Java interpreter. Even in hardware components the Java Virtual Machine can be implemented.

Transmission Control Protocol/IP Stack

The transmission control protocol is shorter than the OSI model:


Application OSI 5-7




h/w Interface OSI 1-2

Fig 6: Shows the graphical representation of the OSI Model.

Connection-Oriented Protocol is known as Transmission Control Protocol and Connectionless Protocol is known as User Datagram Protocol [21].

IP datagram's

The IP datagram's considers each datagram is completely different from other datagram. And the IP datagram's has connectionless and unreliable delivery system. Higher layers should supply in order to get any association between the datagram's. The IP layer of the datagram supplies the checksum in which its own header includes in the checksum supplied. IP layer is also responsible for routing with the help of internet. The IP layer also helps in breaking up of large datagram into smaller ones which is necessary for transmission and also helps in reassembling the broken part on the other side.


It is one of the communication protocols which only give limited services for exchange of messages between the systems in the network which is using IP (Internet Protocol) [41]. However UDP does not provide the sequencing of packets that the data flows in. UDP provides two services which are not provided by the Internet Protocol (IP) layer of the network. They are port numbers, which is used in distinguishing user requests and checksum capability which verifies the intact arrival of data.


It is a set of protocols and with the help Internet Protocol this will be used to exchange the messages in large number units between the systems on Internet [42]. TCP ensures the arrival of data in the correct order. While IP delivers the data, TCP monitors the data units called packets that a message is divided into, for effective transmission through internet. TCP is also known as connection-oriented protocol and is in the transport layer (4th layer) of networks.

Internet Addresses

Internet addresses are 32 bit fixed length guaranteed globally unique numbers. They are useful in locating information on the internet. The internet address is a combination of a routing portion called network part and name portion called host part. Internet address is a subset of IPv4 (Internet Protocol Version 4). The structure comprises of hexadecimal, octal and binary notations.

Network Address

In a network, the computer is served as a unique identifier by the network address. When properly set up, the computers can utilize it for communication purposes after identifying the address of other computers. Best known forms of addresses in the network addresses is the IP address which consists of 32 bits that uniquely identifies all computers on the public internet [21].

Subnet Address

Subnetting can be defined as the process of dividing a network into two or more networks. Subnet addressing is a practice where single IP network address is split into smaller and multiple physical networks known as subnetworks. In the places where the LAN is comparatively small, the node numbers are used as subnet addresses. It consists of a 16 bits identifier.

Host Address

Host address is a part of network address, also called as host ID and is the portion of the IP address used to identify hosts on the network. It has an 8 bit identifier for its address and it has a limitation in the subnet in which only 256 machines can be used [22].

Total Address or IPv4

Types of IPv4 addresses set by the Internet standards are as below.

Unicast - address for a single network interface on a specific subnet and used for one-to-one communications

Multicast - address for one or more network interfaces on various subnets and is used for one-to-many communications

Broadcast - address for all network interfaces on a subnet on the network and is used for one-to-everyone-on-that-subnet communications


Fig 7: IPv4 Address Bits (Google Images. URL:

Port Address

Port addressing is assigning unique port number to different applications so that the data can be forwarded to the correct application. The port addresses are used in the TCP/IP connections. Home network routers and computer software function with ports and sometimes allow the configuration of port numbers. These port numbers allow the sharing of different applications on the same computer to the network resources simultaneously.


It is a data structure in a system which will be maintaining the connections in the network [22]. It is created using the "call socket". Socket address structure is named sockaddr_in and defined by including <netinet/in.h> header. For most socket interfaces, the maximum number of sockets allowed per each connection between an application and the TCP/IP sockets interface is 65 535. The exceptions to this rule are the C sockets interface where the maximum allowed for the interfaces is 2000. Programmers need to be aware that for an application using a sockets interface that uses Sockets Transform. Like a file descriptor it returns an integer. This can be used as both Read File and Write File in Windows,

#include <sys/socket.h>

#include <sys/types.h>

int socket(int type, int protocol, int family);

For IP communications the "family" will be AF_INET, the type depends on whether TCP or UDP is used, the protocol will be zero. Two processes in the network which will want to communicate create a socket each [21] [43].


JFreeChart is a dedicated Java chart library and is free as well. It makes the job easy for developers for the display of professional quality charts in their projects. JFreeChart's prominent feature set includes

A well-documented and consistent API, which supports chart types in a wide range.

Supports many types of outputs which include image files (JPEG, PNG files), vector graphics file formats (SVG, PDF, EPS) and swing components.

The design will be flexible and it targets both client-side and server-side.

Under the terms of GNU LGPL it has been distributed. It is free software and it is an "Open Source". In proprietary applications it will be used [44] [45].

Map Visualization

The values which are showing in the charts are relating to the geographical areas. Some of the examples are: population density in each state of the USA, per capita income for each country in European Union, and life expectancy and longevity ratio in each country across the world. This project also looks into the factors which include: Free sourcing of the redistributable vector outlines across all the countries of the world, states and provinces in USA (particular) [22].

to create a valid dataset interface (additional default implementation), a formally integrating the same with the current X-Y Plot class in JFreeChart, and also conducting testing activities, documentation, and other related activities.

Time Series Chart Interactivity

Time series chart is also known as time series graph and is an illustration of numerical data points at regular intervals. The time series in JFreeChart ensures that the data items are of the same type of period and each period must appear at most once in the series. It also has the feature of interactive time series chart to show a separate control that shows a smaller version of all data items and allows the selection of subset to display in the main chart.


Dashboard can be defined as a user interface, which is similar to that of an automobile's dashboard, and is used to organise and present information in a way which will be easy to read. Many GUI (Graphical user interface) applications resemble a dashboard. May flexible dashboards can be developed using Java Webstart and Applets to support the subsets of the JFreeChart chart types

Property Editors

The property editors provide support to various GUIs that allow users to view and edit a property value of any given type. Most property editors need to support small subset of properties for a given application. This mechanism provides a greater end user control over the display and appearance of charts [22].

J2ME (Java 2 Micro Edition)

Java 2 Micro Edition (J2ME) or Java Platform Micro Edition (Java ME) provides a robust and flexible environment for the applications which run on embedded and mobile devices which include mobile phones, Blu-ray Disc players, set-top boxes, M2M modules, digital media devices, printers and more.

J2ME was originally created to deal with constraints related to the building applications for smaller devices. For this purpose Oracle defined the basics for J2ME to accommodate itself to a smaller environment and see to it that it is possible to create Java applications running on smaller devices with limited memory, power capacity and display.

General Architecture of J2ME

J2ME can be divided into 3 parts namely configuration, profile and optional packages. A configuration contains the cut down version of JVM (Java Virtual Machines) and certain class libraries. A profile is built with these class libraries as the base and by providing a set of APIs. Optional packages are the set of APIs which are optional to use at the time of creation of application. Configuration and the profile are embedded into the devices by default as they are provided by the device manufacturers.


Fig 8: High Level View of the J2ME Architecture (Source: Google Images. URL:

At the centre of J2ME is configuration, whose JVM (Java virtual machine) interacts with the host operating system of the device. One or more J2ME profiles add class libraries that establish access to device features such as I/O and GUI interfaces. When a configuration and a profile come together, they compose a J2ME runtime environment [23].

Developing J2ME applications

MIDP (Mobile Information Device Profile) and CLDC (Connected Limited Device Configuration) are the most popular profile and configuration, respectively, both provided by the Sun. The MID profile and the CLDC configuration complement each other very well as it minimizes memory and the power capacity required for devices which are limited. It provides the basic set of APIs which is used to create application for these devices. As an example, we can consider the API which provides the javax.microedition.lcdui package which allows the creation of the elements of GUI interface which can be shown on a limited device and it executing the MIDP profile on top of the base CLDC configuration. The notable factor here is that MIDP cannot be used along with CDC devices. CDC devices comprise of their own set of profiles, for instance, the Foundation and Personal profiles.

Design Considerations for small devices

Application developing for small or restricted devices requires certain strategies to be followed while going through the design phase. It is always advised to design an application strategically, for a small device even before coding activity begins. Correction of the developed code might crop up because of the failure of considering all of the instincts received before developing the application and it is a painful process indeed. Listed below are some of the design strategies to be considered:

It has to be kept simple. This means removal of unnecessary features, probably building these features as a separate and secondary application.

It has to be small. The smaller the better. This consideration has to be a "no brainer" for all application developers. Smaller applications utilise less memory of the device and required installation time is also short. Consider packaging of the Java applications in the form that is as a compressed Java Archive (.jar) files.

Minimization of run-time memory use. In order to minimize the usage of memory during run time, scalar types are used instead of object types. It is always better not to depend on the garbage collector. Efficient memory management is most necessary and it is accomplished by setting the object references to null once you are finished with them. An alternate way to reduce memory at run-time is to follow lazy instantiation by allocating objects only on an as-needed basis.

Other ways to reduce the overall and peak memory usage on small and restricted devices is to release resources as quick as possible, avoid exceptions and to reuse objects [24].

Configurations Overview

A configuration can be defined as a specification which defines for a range of devices, the software environment, defined by a set of characteristics which the specification relies on. Generally some of the specifications are as mentioned below:

The types and amount of available memory

The speed and processor type

The type of network connection which is available to the device

A configuration is intended to represent the reduced platform for its target device and is not allowed to specify the optional features. Vendors have to implement the specification completely so that the developers can trust on a consistent programming environment. Therefore they can create applications which are device-independent to the possible extent.

J2ME defines two types of configurations:

Connected Limited Device Configuration (CLDC) aims at the lower end of the range of consumer electronics. A typical CLDC platform is a mobile phone of PDA with 512 KB memory available. CLDC is closely related , for this reason, with the wireless Java, which is involved in allowing the mobile phone users to either buy or freely download small applications of Java (also called MIDlets) on their phones. Many mobile phone vendors and Sun Microsystems have signed an agreement to allow them to use this technology.

Connected Device Configuration (CDC) is concerned with the devices which lie between CLDC devices and desktop computers running J2SE. These devices have a memory of about 2 MB or more and have higher capacity processors. Hence they are able to support complete Java software environment. CDC is usually seen in smart phones, residential gateways, web telephones and set-top boxes. Each CDC consists of a JVM and a set of classes which provide the application software with the programming environment.

J2ME Profile Overview

A profile and a configuration complement each other by adding extra classes which provide features that are suitable to a particular type of device. They also provide the classes to a particular vertical market segment. Both types of J2ME configurations can have one or more associated profiles. Some of them may rely on other profiles. These processes can be described in the following list of profiles:

Mobile Information Device Profile (MIDP) adds networking, local storage and user interface components to CLDC. This profile primarily aims at the restricted or the limited display and storage facility of mobile phones. Hence it can provide a simpler user interface and basic network which is based on HTTP 1.1. MIDP is the most popular J2ME profiles as it is based for wireless Java.

PDA Profile (PDAP) and MIDP are similar. The difference is that it aims at the PDAs which have better screens and larger memory than mobile phones. It offers a more sophisticated user interface library.

Foundation Profile - reaches out to CDC and makes it include core Java 2 version 1.3 libraries. It is used as the basis for other CDC profiles as well.

Personal Basis and Personal Profiles - Personal basis profile includes the basic user interface to foundation profile. It is used on unsophisticated devices. Personal profile is used on platforms that support complex user interfaces

RMI Profile includes the J2SE library of remote method invocation to foundation profile. It supports the client side of API.

Game Profile provides a platform for writing games on CDC device [25].