Java (programming language)
| Company type | Programming language |
|---|---|
| Industry | Software development |
| Predecessor | Oak |
| Founded | June 1991 |
| Founder | James Gosling, Mike Sheridan, Patrick Naughton |
Area served | Worldwide |
Key people | James Gosling (creator), Rich Green (Sun VP), Oracle Corporation (current custodian) |
| Products | Java SE, Java EE, Java ME, Java Card, OpenJDK JVM, HotSpot JVM |
| Owner | Oracle Corporation (since 2010) |
| Parent | Sun Microsystems (original developer) |
| Website | www |
Java is a high-level, versatile, memory-safe, and object-oriented programming language engineered with the philosophy of write once, run anywhere (WORA). This design allows compiled Java code to execute on any platform that supports Java without needing recompilation.<ref>Java applications compile into Java bytecode, which runs on any Java virtual machine (JVM) regardless of the underlying computer architecture. Its syntax draws heavily from C and C++, but omits many low-level features. The Java runtime environment also incorporates dynamic features such as reflection and runtime code alteration, capabilities that are rare among traditionally compiled languages.
Since its introduction in 1995, Java has maintained a prominent position among programming languages.<ref>By 2022, it was ranked third in popularity on GitHub. Although still extensively utilized, Java’s usage has gradually decreased as alternative JVM languages have gained momentum.<ref>
Developed by James Gosling at Sun Microsystems, Java was initially launched as the core of Sun’s Java platform. While originally proprietary, most Java technologies were re-licensed under the GPL-2.0-only by 2007 in accordance with the Java Community Process. Following Oracle’s acquisition of Sun in 2010, Oracle introduced its own HotSpot JVM. The official reference implementation is the open-source OpenJDK JVM, which is widely embraced by developers and serves as the default JVM on nearly all Linux distributions.
The latest release is Java 24, current as of . Long-term support editions include Java 8, 11, 17, and 21, all of which continue to receive maintenance updates.
History
The Java project was initiated in June 1991 by James Gosling, Mike Sheridan, and Patrick Naughton. Initially conceived for interactive television applications, the technology proved too advanced for that sector. Originally named Oak after a tree outside Gosling’s office, it was later renamed Java, inspired by Indonesian coffee. Gosling crafted Java with a syntax reminiscent of C/C++ to attract both system and application programmers.
Sun Microsystems officially released Java 1.0 in 1996, emphasizing its write once, run anywhere (WORA) promise alongside free runtime environments for popular platforms. It incorporated configurable security features and quickly gained traction as major web browsers began supporting Java applets. Arthur van Hoff rewrote the Java 1.0 compiler in Java itself to ensure strict adherence to the language specification.
In late 1998, Java 2 debuted as J2SE 1.2 and introduced multiple editions tailored to distinct platforms: J2EE for enterprise server applications, J2ME for mobile devices, and J2SE for desktop environments. These were rebranded in 2006 as Java EE, Java ME, and Java SE respectively to better align with marketing efforts.
Sun pursued formal standardization via ISO/IEC and Ecma International starting in 1997 but eventually withdrew, leaving Java as a de facto standard regulated by the Java Community Process. Sun primarily monetized Java through licensing specialized products such as the Java Enterprise System while offering most implementations free of charge.
On November 13, 2006, Sun began open-sourcing its Java Virtual Machine (JVM) under the GPL-2.0-only license, completing this transition by May 2007 except for a minor proprietary component.
Rich Green, Sun’s vice-president at the time, described Sun’s role as an evangelist for Java. After Oracle’s acquisition of Sun during 2009–10, Oracle positioned itself as the custodian of Java technology with an emphasis on community involvement and transparency. Nevertheless, Oracle later initiated legal action against Google concerning Java usage within the Android SDK.
James Gosling departed from Oracle on April 2, 2010.
In January 2016, Oracle announced that future Java runtimes based on JDK 9 would cease supporting browser plugins.
Java operates across a wide range of markets and devices including laptops, data centers, gaming consoles, and supercomputers.
Oracle strongly advises users to remove outdated versions of Java due to unresolved security vulnerabilities.
Principles
Java was created with five fundamental objectives:
- Emphasizing simplicity, an object-oriented approach, and ease of use.
- Ensuring robustness along with strong security measures.
- Providing architecture-neutral design to support portability.
- Delivering efficient and high-speed execution.
- Supporting interpretation, multithreading, and dynamic capabilities.
Versions
As of 2024, the Java versions receiving long-term support (LTS) include Java 8, 11, 17, and 21, with Java 25 planned for LTS release in September 2025.
Oracle discontinued free public updates for commercial use of Java 8 LTS in January 2019 but continues to offer updates for personal usage. Alternative providers such as Adoptium supply no-cost OpenJDK LTS builds that incorporate additional security enhancements and bug fixes.
Key Java release milestones and their launch dates are as follows:
| Version | Release Date |
|---|---|
| JDK Beta | 1995 |
| JDK 1.0 | January 23, 1996 |
| JDK 1.1 | February 19, 1997 |
| J2SE 1.2 | December 8, 1998 |
| J2SE 1.3 | May 8, 2000 |
| J2SE 1.4 | February 6, 2002 |
| J2SE 5.0 | September 30, 2004 |
| Java SE 6 | December 11, 2006 |
| Java SE 7 | July 28, 2011 |
| Java SE 8 (LTS) | March 18, 2014 |
| Java SE 9 | September 21, 2017 |
| Java SE 10 | March 20, 2018 |
| Java SE 11 (LTS) | September 25, 2018 |
| Java SE 12 | March 19, 2019 |
| Java SE 13 | September 17, 2019 |
| Java SE 14 | March 17, 2020 |
| Java SE 15 | September 15, 2020 |
| Java SE 16 | March 16, 2021 |
| Java SE 17 (LTS) | September 14, 2021 |
| Java SE 18 | March 22, 2022 |
| Java SE 19 | September 20, 2022 |
| Java SE 20 | March 21, 2023 |
| Java SE 21 (LTS) | September 19, 2023 |
| Java SE 22 | March 19, 2024 |
| Java SE 23 | September 17, 2024 |
| Java SE 24 | March 18, 2025 |
Editions
Sun Microsystems established four distinct editions of Java tailored to various application domains by organizing numerous APIs accordingly:
- Java Card designed for use in smart card devices.
- Java Platform, Micro Edition (Java ME), aimed at devices with limited resources.
- Java Platform, Standard Edition (Java SE), intended for desktop and workstation environments.
- Java Platform, Enterprise Edition (Java EE), developed for extensive distributed enterprise or Internet applications.
Java's APIs are structured into packages comprising related classes, interfaces, subpackages, and exceptions.
Additionally, Sun provided Personal Java, which has since been replaced by standardized configurations within the Java ME ecosystem.
Java JVM and bytecode
Java attains platform independence by compiling source code into an intermediate form known as Java bytecode, which executes on platform-specific JVM implementations instead of running directly on the underlying hardware. This design enables consistent operation of Java programs across diverse operating systems and hardware platforms when the appropriate runtime environment is available.
End users generally launch Java applications through a Java Runtime Environment (JRE) or via web browsers when using applets. The standard libraries offer consistent access to system-level features such as graphics rendering, threading capabilities, and network communication.
Although interpreting bytecode initially introduced some performance disadvantages compared to native binaries, the early incorporation of just-in-time (JIT) compilers—such as the Hotspot compiler—significantly enhanced execution speed by translating bytecode into machine instructions during runtime. More sophisticated JIT solutions like GraalVM have introduced tiered compilation strategies that further optimize performance efficiency.
Performance
Historically, Java applications have exhibited slower execution speeds and higher memory consumption compared to those developed in C++. Nevertheless, the introduction of just-in-time compilation around 1997/1998 with Java 1.1 marked a significant boost in runtime efficiency. This improvement was accompanied by language features such as inner classes and StringBuilder, alongside enhancements to the JVM like HotSpot becoming the standard virtual machine in 2000. Further performance gains were realized with Java 1.5 through the addition of concurrency support tailored for multi-core processors, and continued refinements persisted into Java 1.6.
Non-JVM
Certain hardware platforms offer native execution capabilities for Java bytecode, including specific microcontrollers and some ARM processors equipped with the Jazelle extension. However, this form of direct support has mostly been phased out in recent ARM processor designs.
Automatic memory management
Java utilizes automatic garbage collection to oversee memory allocation and reclamation during an object's lifecycle. While developers instantiate objects, the runtime environment reclaims memory once these objects are no longer accessible, mitigating common issues linked to manual memory handling found in languages requiring explicit allocation and freeing. Despite this, logical memory leaks can still arise if references to unused objects persist.
Garbage collection operates asynchronously and unpredictably, ideally activating during periods of low CPU usage but may also initiate when available heap memory diminishes, occasionally causing short pauses in program execution. Java disallows explicit memory control and pointer arithmetic akin to C/C++, which enhances type safety and permits object relocation by the garbage collector.
For performance optimization, primitive types are stored on the stack or embedded within object fields, whereas non-primitive objects reside on the heap. Starting with Java 9, HotSpot's default garbage collector is the Garbage First Garbage Collector (G1GC), with alternatives like Z Garbage Collector (ZGC) introduced in Java 11 and Shenandoah GC available in select OpenJDK distributions. Earlier releases defaulted to the Parallel Garbage Collector.
Although memory management is automated, developers remain responsible for properly handling resources such as network sockets and file descriptors, particularly in scenarios involving exceptions.
Syntax
Java's syntax draws heavily from C++ and C, yet unlike C++, which supports structured, generic, and object-oriented paradigms within its syntax, Java was crafted primarily as an object-oriented language.[1] All executable code is encapsulated within classes, with nearly all data represented as objects except for primitive types—such as integers, floating-point numbers, booleans, and characters—which remain non-object types for enhanced performance. Java also adopts familiar features from C++, including the method.
The language does not permit operator overloading[2] nor multiple inheritance of classes; however, it supports multiple inheritance through interfaces.[3]
Commenting conventions in Java mirror those of C++, encompassing single-line comments (//), block comments (/* ... */), and Javadoc documentation comments (/** ... */). The Javadoc format enables automated documentation generation and seamless integration with development environments such as Eclipse, thereby improving developer efficiency.
Hello world
A simple illustration showcasing Java syntax: <syntaxhighlight lang="java" line="1">public class Example {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}</syntaxhighlight>
Applet
Java applets were small programs embedded within other software, mainly web browsers. The applet API was marked as deprecated starting with Java 9 (2017), signaling a move away from Java applications running inside browsers.
Servlet
Java servlet technology provides web developers with a reliable way to extend web server capabilities and integrate with business systems. Servlets are server-side Java EE components that respond to client requests, commonly generating HTML content for HTTP calls. Additional servlet types enable support for protocols such as WebSocket.
The Java servlet API remains fundamental but has been partially supplanted by two key Java web service standards:
- Java API for RESTful Web Services (JAX-RS 2.0), supporting AJAX, JSON, and RESTful services
- Java API for XML Web Services (JAX-WS), used for SOAP based Web Services
Servlet containers or application servers typically employ a standard servlet to process HTTP requests and forward business logic to these web service interfaces.
JavaServer Pages
JavaServer Pages (JSP) are server-side components within Java EE that produce responses—usually in the form of HTML—to client HTTP requests. JSPs contain embedded Java code enclosed within <% and %> tags. Upon initial access, the JSP is compiled into a Java servlet, which then manages all subsequent requests.
Swing application
Swing is a GUI toolkit for the Java SE platform, offering customizable appearances through its pluggable look and feel architecture. Sun Microsystems provides styles mimicking Windows, GTK+, and Motif, while Apple contributes an Aqua theme for macOS. In Java SE 6, Swing enhances graphical interface quality by utilizing native widget rendering across different operating systems.
JavaFX application
JavaFX serves as a platform for building and deploying rich desktop and web applications across multiple device types. Intended as the successor to Swing as the primary GUI framework for Java SE, it was decoupled from the core JDK starting with JDK 11 and is now distributed as an independent module. JavaFX supports Windows, Linux, and macOS environments on both desktop and browser platforms but does not fully integrate native operating system look and feel features.
Generics
Introduced in 2004 with J2SE 5.0, generics added compile-time type verification for container classes in Java, eliminating the need to create multiple versions for various data types. This advancement enhanced code robustness and minimized runtime errors such as ClassCastException, thereby strengthening type safety. Nevertheless, in 2016, it was revealed that Java's type system is not entirely sound: some generic constructs can compile without errors but may trigger runtime class cast exceptions by permitting incompatible assignments between unrelated types.
Criticism
Java has faced criticism regarding several aspects, including its generics implementation, execution speed, lack of unsigned number support, floating-point arithmetic behavior, and a history of security issues in the primary Java Virtual Machine (HotSpot). Additionally, developers have expressed concerns about the complexity and verbosity of the Java Persistence API (JPA), which has encouraged a growing preference for higher-level frameworks like Spring Data JPA that streamline database interactions and reduce boilerplate code. This trend underscores the challenges developers encounter when using standard JPA for contemporary application development.
Class libraries
The Java Class Library serves as the foundational library set for Java software development and is governed by Oracle through the Java Community Process. While this collaborative process allows stakeholders to influence API evolution, it has been met with some controversy. The library encompasses:
- Core components:
- Input/output (I/O) along with non-blocking I/O (NIO)
- Networking capabilities, including a modern HTTP client introduced in Java 11
- Reflection APIs
- Concurrency utilities
- Support for generics
- Scripting interfaces and compiler tools
- Functional programming features such as lambdas and streams
- Collections framework providing implementations of lists, maps, trees, sets, queues, and stacks
- XML processing tools
- Security modules
- Internationalization and localization support
- Integration modules facilitating external system interoperability:
- Java Database Connectivity (JDBC) API for database interactions
- Java Naming and Directory Interface (JNDI)
- Remote method invocation (RMI) and CORBA for distributed computing
- Java Management Extensions (JMX) for system monitoring and management
- User interface toolkits:
- Abstract Window Toolkit (AWT), offering native GUI components and event handling mechanisms
- Swing libraries built atop AWT delivering platform-independent widget implementations
- APIs supporting audio capture, processing, and playback functionalities
- JavaFX framework
Additional elements include a platform-specific Java Virtual Machine responsible for executing bytecode, browser plugins enabling applet execution, Java Web Start for streamlined Internet-based application deployment, along with licensing agreements and comprehensive documentation.
Documentation
Developed by Sun Microsystems, Javadoc is an extensive system designed to organize code documentation effectively. It utilizes special comment delimiters /** and */ that differentiate Javadoc comments from regular Java comments.
Implementations
Following its acquisition of Sun Microsystems in 2010, Oracle Corporation maintains the official Java SE implementation derived from Sun’s original codebase. This implementation supports multiple operating systems including Windows, macOS, Linux, and Solaris. Since no formal standardization exists through organizations like Ecma International or ISO/IEC, Oracle’s distribution functions as the de facto standard.
Oracle provides two primary packages: the Java Runtime Environment (JRE), intended for end users to execute Java applications, and the Java Development Kit (JDK), targeted at developers with tools such as the Java compiler, Javadoc, Jar archiver, and debugger. Oracle also created GraalVM, a high-performance dynamic compiler combined with an interpreter.
OpenJDK, released under the GNU General Public License (GPL), originated when Sun made Java’s source code available under this license. Since Java SE 7, OpenJDK has served as the official reference implementation.
Java strives to maintain compatibility across different implementations. Sun’s trademark license mandated compatibility compliance, leading to a legal dispute with Microsoft over their non-conforming Java version. The 2001 settlement awarded Sun $20 million and enforced licensing terms that resulted in Microsoft discontinuing bundling Java with Windows.
Ensuring platform independence is essential for Java EE, which requires more rigorous certification to guarantee portability of server-side applications across certified implementations.
Use beyond the Java platform
Executing compiled Java programs necessitates a supporting software environment.
Oracle supplies the Java platform for this purpose, whereas the Android SDK acts as an alternative framework, primarily designed for creating Android applications and featuring its own graphical user interface system.
Android
Java plays a fundamental role within Android, an open source mobile operating system. While Android is predominantly developed in C and built on the Linux kernel, its SDK relies on Java as the primary language for app development. However, it does not incorporate the conventional Java GUI, SE, ME, or other standard Java specifications. The bytecode used by Android differs from typical Java bytecode and executes on a specialized virtual machine tailored for devices with limited memory capacity such as smartphones and tablet computers. Depending on the Android version, this bytecode is either interpreted by the Dalvik virtual machine or compiled directly to native code via the Android Runtime.
Android does not include the complete Java SE standard library; instead, it offers an independent implementation covering much of it, supporting features from Java 6 and some from Java 7 through a compatible library (Apache Harmony).
Legal dispute
The adoption of Java technology within Android sparked a significant legal confrontation between Oracle and Google. In 2012, a jury concluded that if APIs are subject to copyright protection, Google had violated Oracle’s copyrights through its use of Java in Android. Contrarily, District Judge William Alsup ruled that APIs are not eligible for copyright—a judgment later overturned in 2014 by the United States Court of Appeals for the Federal Circuit.
In 2016, a district court determined that Google's utilization of Java APIs qualified as fair use; however, this decision was reversed by the Appeals Court in 2018, which sent the matter of damages back to federal court. Google subsequently petitioned the Supreme Court of the United States in 2019 to contest rulings favoring Oracle.
On April 5, 2021, the Supreme Court delivered a 6–2 decision supporting Google, affirming that its use of Java APIs constituted fair use while deliberately avoiding ruling on whether APIs themselves can be copyrighted by assuming that question purely hypothetically.
See also
- C#
- C++
- Dalvik, previously utilized in Android, superseded by non-JIT Android Runtime
- Java Heterogeneous Distributed Computing
- List of Java APIs
- List of Java frameworks
- List of JVM languages
- List of Java virtual machines
- Comparison of C# and Java
- Comparison of Java and C++
Bibliography
External links
- , OpenJDK, Oracle
- JDK builds, Adoptium
- Articles with short description
- Java (programming language)
- C programming language family
- Class-based programming languages
- Concurrent programming languages
- Java platform
- JVM programming languages
- Multi-paradigm programming languages
- Object-oriented programming languages
- Programming languages created in 1995
- Statically typed programming languages
- Sun Microsystems
- Pages with reference errors