Вы находитесь на странице: 1из 5

JAVA LECTURE 1

HISTORY
Java is a programming language originally developed by James Gosling at Sun Microsystems (which is now a subsidiary
of Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much
of its syntax from C and C++ but has a simplerobject model and fewer low-level facilities. Java applications are
typically compiled to bytecode (class file) that can run on any Java Virtual Machine (JVM) regardless of computer architecture. Java
is general-purpose, concurrent, class-based, and object-oriented, and is specifically designed to have as few implementation
dependencies as possible. It is intended to let application developers "write once, run anywhere". Java is currently one of the most
popular programming languages in use, and is widely used from application software to web applications

About the Java Technology


Java technology is both a programming language and a platform.

The Java Programming Language

The Java programming language is a high-level language that can be characterized by all of the following
buzzwords:

 Architecture
 Simple
neutral
 Object
 Portable
oriented
 Distributed  High performance
 Multithreaded  Robust
 Dynamic  Secure

In the Java programming language, all source code is first written in plain text files ending with
the .java extension. Those source files are then compiled into .classfiles by the javac compiler.
A .class file does not contain code that is native to your processor; it instead contains bytecodes — the machine
language of the Java Virtual Machine1 (Java VM). The java launcher tool then runs your application with an
instance of the Java Virtual Machine.

An overview of the software development process.

Because the Java VM is available on many different operating systems, the same .class files are capable of
running on Microsoft Windows, the Solaris TM Operating System (Solaris OS), Linux, or Mac OS. Some virtual
machines, such as the Java Hotspot virtual machine, perform additional steps at runtime to give your application a
performance boost. This includes various tasks such as finding performance bottlenecks and recompiling (to native
code) frequently used sections of code.
Through the Java VM, the same application is capable of
running on multiple platforms.

The Java Platform

A platform is the hardware or software environment in which a program runs. We've already mentioned some of the
most popular platforms like Microsoft Windows, Linux, Solaris OS, and Mac OS. Most platforms can be described
as a combination of the operating system and underlying hardware. The Java platform differs from most other
platforms in that it's a software-only platform that runs on top of other hardware-based platforms.

The Java platform has two components:

 The Java Virtual Machine


 The Java Application Programming Interface (API)

You've already been introduced to the Java Virtual Machine; it's the base for the Java platform and is ported onto
various hardware-based platforms.

The API is a large collection of ready-made software components that provide many useful capabilities. It is
grouped into libraries of related classes and interfaces; these libraries are known as packages.

The API and Java Virtual Machine insulate the program


from the underlying hardware.
How Will Java Technology Change My Life?
Java technology will help you do the following:

 Get started quickly: Although the Java programming language is a


powerful object-oriented language, it's easy to learn, especially for
programmers already familiar with C or C++.
 Write less code: Comparisons of program metrics (class counts, method
counts, and so on) suggest that a program written in the Java
programming language can be four times smaller than the same program
written in C++.
 Write better code: The Java programming language encourages good
coding practices, and automatic garbage collection helps you avoid
memory leaks. Its object orientation, its JavaBeans component
architecture, and its wide-ranging, easily extendible API let you reuse
existing, tested code and introduce fewer bugs.
 Develop programs more quickly: The Java programming language is
simpler than C++, and as such, your development time could be up to
twice as fast when writing in it. Your programs will also require fewer
lines of code.
 Avoid platform dependencies: You can keep your program portable by
avoiding the use of libraries written in other languages.
 Write once, run anywhere: Because applications written in the Java
programming language are compiled into machine-independent
bytecodes, they run consistently on any Java platform.
 Distribute software more easily: With Java Web Start software, users
will be able to launch your applications with a single click of the mouse.
An automatic version check at startup ensures that users are always up to
date with the latest version of your software. If an update is available,
the Java Web Start software will automatically update their installation.
Definition of: JDK 

(Java Development Kit) A Java software development environment from Sun. It includes the JVM, compiler,
debugger and other tools for developing Java applets and applications. Each new version of the JDK adds features
and enhancements to the language. When Java programs are developed under the new version, the Java
interpreter (Java Virtual Machine) that executes them must also be updated to that same version.
See JFC andOpenJDK.

Basic MS-DOS Commands for CSCI Students


Essential Commands

dir Lists names of files in current directory (folder)

dir Hello.* Lists all files whose names start with Hello.

cd C:\files Changes directory to C:\files ("absolute" pathname)

Changes directory to myfiles subdirectory of current


cd myfiles
directory ("relative" pathname)

cd .. Changes directory to "parent" of current directory

notepad Hello.java MS-DOS text editor, used to create and edit ASCII textfiles

type Hello.java Displays contents of ASCII textfile on screen

Ends command interpreter, makes console window go


exit
away...

Useful File Management Commands

copy Test1.java Copies contents of Test1.java to new


Test2.java file Test2.java

ren Test1.java
Test2.java
Renames Test1.java to Test2.java

Deletes Test1.java (Be careful with this


del Test1.java
command...)

Deletes all files with Test1 prefix (Be even more


del Test1.*
careful with this command...)

Creates new directory playpen as subdirectory of


mkdir playpen
current directory

rmdir playpen Removes directory playpen (must be empty)

Commands for Compiling and Running Java Applications

Note: if the commands in this table are not recognized by the MS-DOS command
interpreter on your system, try using the path commands listed below...
Compiles Java source file Hello.java (ASCII textfile),
javac Hello.java
produces bytecode file Hello.class (binary file)

"Runs" Java application: starts Java Virtual


Machine (interpreter),
java Hello
which executes Java bytecode instructions in
file Hello.class

Using javadoc to Document Java Classes

Note: if the commands in this table are not recognized by the MS-DOS command
interpreter on your system, try using the path commands listed below...

Generates Web document Cat.html, containing


description of Cat class. Complete documentation
javadoc Cat
requires inclusion of javadoc comments (/** .. */) in
source code.

Commands for Manipulating Environment Variables

Displays current value of


PATH environment variable
path
(list of directories containing
DOS command programs)

Adds named directory (a JDK


system directory in this
set path=C:\Program example) to current PATH
Files\Java\jdk1.6.0_15\bin;%PATH% environment variable
(applies only to current
session).

Вам также может понравиться