Documente Academic
Documente Profesional
Documente Cultură
4
5
6
7
8
9
Platform
The Java platform is a suite of programs that facilitate developing and running
programs written in the Java programming language. A Java platform will include
an execution engine (called a virtual machine), a compiler and a set of librarie
s; there may also be additional servers and alternative libraries that depend on
the requirements. Java is not specific to any processor or operating system as
Java platforms have been implemented for a wide variety of hardware and operatin
g systems with a view to Java programs running identically on all of them. Platf
orms target different classes of device and application domain:
Java Card: A technology that allows small Java-based applications (applets)
to be run securely on smart cards and similar small-memory devices.
Java ME (Micro Edition): Specifies several different sets of libraries (know
n as profiles) for devices with limited storage, display, and power capacities.
Often used to develop applications for mobile devices, PDAs, TV set-top boxes, a
nd printers.
Java SE (Standard Edition): For general-purpose use on desktop PCs, servers
and similar devices.
Java EE (Enterprise Edition): Java SE plus various APIs useful for multi-tie
r clientserver enterprise applications.
The Java platform consists of several programs, each of which provides a portion
of its overall capabilities. For example, the Java compiler, which converts Jav
a source code into Java bytecode (an intermediate language for the JVM), is prov
ided as part of the Java Development Kit (JDK). The Java Runtime Environment (JR
E), complementing the JVM with a just-in-time (JIT) compiler, converts intermedi
ate bytecode into native machine code on the fly. An extensive set of libraries
are also part of the Java platform.
The essential components in the platform are the Java language compiler, the lib
raries, and the runtime environment in which Java intermediate bytecode executes
according to the rules laid out in the virtual machine specification.
Java Virtual Machine
Main article: Java Virtual Machine
The heart of the Java platform is the concept of a "virtual machine" that execut
es Java bytecode programs. This bytecode is the same no matter what hardware or
operating system the program is running under. There is a JIT (Just In Time) com
piler within the Java Virtual Machine, or JVM. The JIT compiler translates the J
ava bytecode into native processor instructions at run-time and caches the nativ
e code in memory during execution.
Kotlin An industrial programming language for JVM with full Java interoperab
ility
Rhino A JavaScript interpreter
Scala A multi-paradigm programming language designed as a "better Java"
Gosu A general-purpose Java Virtual Machine-based programming language relea
sed under the Apache License 2.0
Similar platforms
See also: Comparison of the Java and .NET platforms and Comparison of C# and Jav
a
The success of Java and its write once, run anywhere concept has led to other si
milar efforts, notably the .NET Framework, appearing since 2002, which incorpora
tes many of the successful aspects of Java. .NET in its complete form (Microsoft
's implementation) is currently only fully available on Windows platforms, where
as Java is fully available on many platforms. .NET was built from the ground-up
to support multiple programming languages, while the Java platform was initially
built to support only the Java language, although many other languages have bee
n made for JVM since.
.NET includes a Java-like language called Visual J# (formerly named J++) that is
incompatible with the Java specification, and the associated class library most
ly dates to the old JDK 1.1 version of the language. For these reasons, it is mo
re a transitional language to switch from Java to the .NET platform, than a firs
t class .NET language. Visual J# was discontinued with the release of Microsoft
Visual Studio 2008. The existing version shipping with Visual Studio 2005 will b
e supported until 2015 as per the product life-cycle strategy.
Java Development Kit
Main article: Java Development Kit
The Java Development Kit (JDK) is a Sun product aimed at Java developers. Since
the introduction of Java, it has been by far the most widely used Java software
development kit (SDK).[citation needed] It contains a Java compiler, a full copy
of the Java Runtime Environment (JRE), and many other important development too
ls.
History
The Java platform and language began as an internal project at Sun Microsystems
in December 1990, providing an alternative to the C++/C programming languages. E
ngineer Patrick Naughton had become increasingly frustrated with the state of Su
n's C++ and C application programming interfaces (APIs) and tools. While conside
ring moving to NeXT, Naughton was offered[by whom?] a chance to work on new tech
nology, and thus the Stealth Project started.
The Stealth Project was soon renamed to the Green Project, with James Gosling an
d Mike Sheridan joining Naughton. Together with other engineers, they began work
in a small office on Sand Hill Road in Menlo Park, California. They aimed to de
velop new technology for programming next-generation smart appliances, which Sun
expected to offer major new opportunities.[16]
The team originally considered using C++, but rejected it for several reasons. B
ecause they were developing an embedded system with limited resources, they deci
ded that C++ needed too much memory and that its complexity led to developer err
ors. The language's lack of garbage collection meant that programmers had to man
ually manage system memory, a challenging and error-prone task. The team also wo
rried about the C++ language's lack of portable facilities for security, distrib
uted programming, and threading. Finally, they wanted a platform that would port
easily to all types of devices.
Bill Joy had envisioned a new language combining Mesa and C. In a paper called F
eased, and Sun's JVM was equipped with a JIT compiler for the first time.
J2SE 1.3 (May 8, 2000) Codename Kestrel. Notable changes included the bundling o
f the HotSpot JVM (the HotSpot JVM was first released in April, 1999 for the J2S
E 1.2 JVM), JavaSound, Java Naming and Directory Interface (JNDI) and Java Platf
orm Debugger Architecture (JPDA).
J2SE 1.4 (February 6, 2002) Codename Merlin. This became the first release of th
e Java platform developed under the Java Community Process as JSR 59.[21] Major
changes included regular expressions modeled after Perl, exception chaining, an
integrated XML parser and XSLT processor (JAXP), and Java Web Start.
J2SE 5.0 (September 30, 2004) Codename Tiger. Originally numbered 1.5, which is
still used as the internal version number.[22] Developed under JSR 176, Tiger ad
ded several significant new language features including the for-each loop, gener
ics, autoboxing and var-args.[23]
Java SE 6 (December 11, 2006) Codename Mustang. Bundled with a database manager
and facilitates the use of scripting languages with the JVM (such as JavaScript
using Mozilla's Rhino engine). As of this version, Sun replaced the name "J2SE"
with Java SE and dropped the ".0" from the version number.[24] Other major chang
es include support for pluggable annotations (JSR 269), many GUI improvements, i
ncluding native UI enhancements to support the look and feel of Windows Vista, a
nd improvements to the Java Platform Debugger Architecture (JPDA) & JVM Tool Int
erface for better monitoring and troubleshooting.
Java SE 7 (July 28, 2011) Codename Dolphin. This version developed under JSR 336
.[25] It added many small language changes including strings in switch, try-with
-resources and type inference for generic instance creation. The JVM was extende
d with support for dynamic languages, while the class library was extended among
others with a join/fork framework,[26] an improved new file I/O library and sup
port for new network protocols such as SCTP. Java 7 Update 76 was released in Ja
nuary 2015, with expiration date April 14, 2015.[27]
The current version, Java SE 8 (March 18, 2014). Notable changes include languag
e-level support for lambda expressions (closures) and default methods, the Proje
ct Nashorn JavaScript runtime, a new Date and Time API inspired by Joda Time, an
d the removal of PermGen. This version is not officially supported on the Window
s XP platform.[28] However, due to the end of Java 7's lifecycle it is the recom
mended version for XP users. Previously, only an unofficial manual installation
method had been described for Windows XP SP3. It refers to JDK8, the developing
platform for Java that also includes a fully functioning Java Runtime Environmen
t.[29]
In addition to language changes, significant changes have been made to the Java
class library over the years, which has grown from a few hundred classes in JDK
1.0 to over three thousand in J2SE 5.0. Entire new APIs, such as Swing and Java
2D, have evolved, and many of the original JDK 1.0 classes and methods have been
deprecated.
Usage
Desktop use
According to Oracle, the Java Runtime Environment is found on over 850 million P
Cs.[30] Microsoft has not bundled a Java Runtime Environment (JRE) with its oper
ating systems since Sun Microsystems sued Microsoft for adding Windows-specific
classes to the bundled Java runtime environment, and for making the new classes
available through Visual J++.[citation needed] Apple no longer includes a Java r
untime with OS X as of version 10.7, but the system prompts the user to download
and install it the first time an application requiring the JRE is launched.[cit
ation needed] Many Linux distributions include the partially compatible free sof
fr
an
Gl
bu
rity of distributions, such as Fedora, RHEL, Debian, Ubuntu, Gentoo, Arch Linux
and Slackware, as it provides security releases and an easier means for patch in
clusion. OpenJDK also still doesn't include a browser plugin & Web Start impleme
ntation, so IcedTea's companion project, IcedTea-Web, is needed to fill this gap
.
In June 2008, it was announced that IcedTea6 (as the packaged version of OpenJDK
on Fedora 9) has passed the Technology Compatibility Kit tests and can claim to
be a fully compatible Java 6 implementation.[44]
Because OpenJDK is under the GPL, it is possible to redistribute a custom versio
n of the JRE directly with software applications,[45][46] rather than requiring
the enduser (or their sysadmin) to download and install the correct version of t
he proprietary Oracle JRE onto each of their systems themselves.
Criticism
Main article: Criticism of Java
In most cases, Java support is unnecessary in Web browsers, and security experts
recommend that it not be run in a browser unless absolutely necessary.[47] It w
as suggested that, if Java is required by a few Web sites, users should have a s
eparate browser installation specifically for those sites.
Generics
Further information: Generics in Java
When generics were added to Java 5.0, there was already a large framework of cla
sses (many of which were already deprecated), so generics were chosen to be impl
emented using erasure to allow for migration compatibility and re-use of these e
xisting classes. This limited the features that could be provided by this additi
on as compared to some other languages.[48][49]
Unsigned integer types
Java lacks native unsigned integer types. Unsigned data are often generated from
programs written in C and the lack of these types prevents direct data intercha
nge between C and Java. Unsigned large numbers are also used in many numeric pro
cessing fields, including cryptography, which can make Java less convenient to u
se for these tasks.[50] Although it is possible to partially circumvent this pro
blem with conversion code and using larger data types, it makes using Java cumbe
rsome for handling the unsigned data. While a 32-bit signed integer may be used
to hold a 16-bit unsigned value with relative ease, a 32-bit unsigned value woul
d require a 64-bit signed integer. Additionally, a 64-bit unsigned value cannot
be stored using any integer type in Java because no type larger than 64 bits exi
sts in the Java language. If abstracted using functions, function calls become n
ecessary for many operations which are native to some other languages. Alternati
vely, it is possible to use Java's signed integers to emulate unsigned integers
of the same size, but this requires detailed knowledge of complex bitwise operat
ions.[51]
Floating point arithmetic
While Java's floating point arithmetic is largely based on IEEE 754 (Standard fo
r Binary Floating-Point Arithmetic), certain features are not supported even whe
n using the strictfp modifier, such as Exception Flags and Directed Roundings ca
pabilities mandated by IEEE Standard 754. Additionally, the extended precision f
loating-point types permitted in 754 and present in many processors are not perm
itted in Java.[52][53]
Performance
Further information: Java performance
In the early days of Java (before the HotSpot VM was implemented in Java 1.3 in
2000) there were some criticisms of performance. However, benchmarks typically r
eport Java as being about 50% slower than C (a language which compiles to native
code).[54][55][56]
Java's performance has improved substantially since the early versions.[57] Perf
ormance of JIT compilers relative to native compilers has in some optimized test
s been shown to be quite similar.[57][58][59]
Java bytecode can either be interpreted at run time by a virtual machine, or it
can be compiled at load time or runtime into native code which runs directly on
the computer's hardware. Interpretation is slower than native execution, and com
pilation at load time or runtime has an initial performance penalty for the comp
ilation. Modern performant JVM implementations all use the compilation approach,
so after the initial startup time the performance is equivalent to native code.
Security
Further information: Java security
The Java platform provides a security architecture[60] which is designed to allo
w the user to run untrusted bytecode in a "sandboxed" manner to protect against
malicious or poorly written software. This "sandboxing" feature is intended to p
rotect the user by restricting access to certain platform features and APIs whic
h could be exploited by malware, such as accessing the local filesystem, running
arbitrary commands, or accessing communication networks.
In recent years, researchers have discovered numerous security flaws in some wid
ely used Java implementations, including Oracle's, which allow untrusted code to
bypass the sandboxing mechanism, exposing users to malicious attacks. These fla
ws affect only Java applications which execute arbitrary untrusted bytecode, suc
h as web browser plug-ins that run Java applets downloaded from public websites.
Applications where the user trusts, and has full control over, all code that is
being executed are unaffected.
On August 31, 2012, Java 6 and 7 on Microsoft Windows, Mac OS X, and Linux were
found to have a serious security flaw that allowed a remote exploit to take plac
e by simply loading a malicious web page.[61] Java 5 was later found to be flawe
d as well.[62]
On January 10, 2013, three computer specialists spoke out against Java, telling
Reuters that it was not secure and that people should disable Java. Jaime Blasco
, Labs Manager with AlienVault Labs, stated that "Java is a mess. Its not secure.
You have to disable it."[63] This vulnerability affects Java 7 and it is unclea
r if it affects Java 6, so it is suggested that consumers disable it.[64][65] Se
curity alerts from Oracle announce schedules of critical security-related patche
s to Java.[66]
On January 14, 2013, security experts said that the update still failed to prote
ct PCs from attack.[67] This exploit hole prompted a response from the United St
ates Department of Homeland Security encouraging users to disable or uninstall J
ava.[68] Apple blacklisted Java in limited order for all computers running its M
ac OS X operating system through a virus protection program.[69]
Adware
The Java browser runtime environment has a history of bundling sponsored softwar
e to be installed by default during installation and during the updates which ro
ll out every month or so. This includes the "Ask.com toolbar" that will redirect
browser searches to ads and "McAfee Security Scan Plus".[70]
Redundancy
Several authors[weasel words] inline with recent Java security and vulnerability
issues have called for users to ditch Java. "Once promising, it has outlived it
s usefulness in the browser, and has become a nightmare that delights cyber-crim
inals at the expense of computer users."[71] "I think everyone should uninstall
Java from all their PCs and Macs, and then think carefully about whether they ne
ed to add it back. If you are a typical home user, you can probably do without i
t. If you are a business user, you may not have a choice."[72]
Update system
Java has yet to release an automatic updater that does not require user interven
tion and administrative rights[73] unlike Google Chrome[74] and Flash player.[75
]