0% found this document useful (0 votes)
45 views

Software Development 2

This document provides an introduction to the Java programming language and environment. It discusses that Java is an object-oriented language that is compiled to bytecode, allowing programs to run on any system with a Java Virtual Machine. It also describes the Java platform components, types of Java projects like applications and applets, and development tools for writing Java code like the JDK and IDEs. An exercise is included to research current Java versions and editions on the Oracle website.

Uploaded by

Thomas AJITH
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

Software Development 2

This document provides an introduction to the Java programming language and environment. It discusses that Java is an object-oriented language that is compiled to bytecode, allowing programs to run on any system with a Java Virtual Machine. It also describes the Java platform components, types of Java projects like applications and applets, and development tools for writing Java code like the JDK and IDEs. An exercise is included to research current Java versions and editions on the Oracle website.

Uploaded by

Thomas AJITH
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

School of Science & Technology

Software Development 2

SOFTWARE DEVELOPMENT 2
Software Development 2 Bell College

1: INTRODUCTION TO JAVA

What is Java? ..................................................................................................................2


The Java Platform ........................................................................................................... 3
Types of Java project ..................................................................................................... 3
Java Development Tools ................................................................................................ 4
EXERCISE ........................................................................................................................ 4

What is Java?
The Java programming language is a high-level object-oriented language which was
developed by Sun Microsystems. Like other object oriented languages, Java programs
use classes and objects. In this course you will learn what these are and how to use
them.

Java is more than simply a programming language. It is a cross platform software


environment, which means that the same program can run on many different
combinations of processor and operating system, without being recompiled for each
platform.

In most programming languages, a simple program can be created as a source file,


which is then compiled to give an executable (machine code) file for a specific computer
system. To make the same program run on another platform, it must be recompiled for
that platform.

A Java source file is compiled to an intermediate language called bytecode. Bytecode is


interpreted by a piece of software called a Java Virtual Machine (JVM), which
translates it into the machine code for the system it runs on. The bytecode is exactly the
same for all system.

You write and compile your program once, and it will run on any platform that has a
JVM.

Java source files have a .java extension.

Bytecode (compiled) files have a .class extension.

Advantage: Java programs are portable between platforms with no additional


programming effort – this is valuable as many organisations use a variety of computer
systems.

Disadvantage: Java can be slower than other languages as it is interpreted rather than
native machine code. It is possible to compile Java programs to native code for specific
processors, and some Java development tools allow this, but the cross platform
capability is then lost.

1. Introduction to Java page 2


Software Development 2 Bell College

The Java Platform

The Java platform consists of the following:

• The JVM

• The Java Application Programming Interface (API).

The JVM provides the environment on which Java programs can run. The API provides
a large collection of software components, or classes, which the programmer can
include in programs. These provide a wide range of capabilities, e.g. user interface
components, networking components, and many more. These components are
organised in packages.

The Java platforms are available for most combinations of operating systems and
processors, including Windows, Unix, Linux, MacOS, and also for other more specialised
systems such as embedded processors in devices such as mobile phones and handheld
computers. For each system, there are runtime and development versions of the Java
platform:

The Java Runtime Environment (JRE)

This provides the JVM and the core Java classes. If you want to simply run existing Java
programs on a system, then it is sufficient to have a JRE installed on the system.

The Java Software Development Kit (JDK or Java SDK)

This includes the JRE, together with compilers and debuggers and other development
tools. If you want to develop Java programs, a JDK must be installed on your system.

Types of Java project


Java can be used in many different ways. Some of the major types of Java project are:

Applications
An application is a standalone program which runs on a JVM. It can produce text output
to a command console, or it can have a graphical interface similar to a Visual Basic
application. Graphical Java applications use the user interface components provided by
the JVM, and look the same on any platform. .

Applets
An applet is a program designed to run inside a web browser. A web page will have an
area set aside to display the output from an applet, and the applet is downloaded over

1. Introduction to Java page 3


Software Development 2 Bell College

the web and runs in the browser. The output is usually graphical, and can use some of
the same user interface components as an application.

Web Applications
A web application is a program which runs on a web server. Java web applications use
technologies called servlets and Java Server Pages (JSP). Web applications are often
used in web sites which interact with databases.

Java Development Tools


The only software which is actually needed to write, compile and run Java programs is a
JDK and a text editor. Current versions of the JDK (and JRE) are available free from
Sun, and can be downloaded from their web site. Previous versions can also be
downloaded.

A source file can be created using the text editor and saved as a .java file. The JDK
provides a compiler which can be run from a command line prompt to create a .class
file. The .class file can then be executed from the command prompt.

Productivity can be improved greatly by using an Integrated Development


Environment (IDE), similar to the Visual Basic environment. Commonly used IDEs
include NetBeans, Eclipse and Borland JBuilder.

In this course we will use BlueJ, an IDE which has been specifically designed for
learning Java.

EXERCISE

Go to Sun’s Java web site at http://java.sun.com and find out the answers to the
following:
1. The first version of Java was version 1.0. What is the current version?
2. What editions of Java are available?
3. Search the online J2SE documentation for the System class – can you see what
version of the JDK this class was introduced in? (The Java documentation is very
useful when you are programming – it is a good idea to get to know where to look
right from the start!)

1. Introduction to Java page 4

You might also like