Programming language · 1995

Java

Object-oriented programming language.

Official site ›
Java logo
JavaWritten in
1995First released
Sun MicrosystemsDeveloper
staticTyping
GNU General Public LicenseLicense
Built fromInfluenced Java JavaC++SmalltalkSimulaAdaMesaKotlinScalaGroovyJavaScriptC#DDartPHP
CompilerInfluence
ReplacedC++ for portable enterprise and server software
Being replaced byKotlin on Android, and Go or Rust for many new back-end services

What is Java written in?

Java has several layers. The javac compiler is written in Java, while the HotSpot JVM runtime is written mainly in C and C++. The Java standard library is largely written in Java.

What Java is used for

Java is a workhorse of enterprise back-end systems, Android apps, and big-data tooling. Its "write once, run anywhere" JVM, strong tooling, and vast ecosystem (Spring, Hibernate) make it a staple of banks, large web services, and Android development.

Notable software: Android apps, Minecraft (Java Edition), and big-data systems like Apache Hadoop, Kafka, and Elasticsearch.

About Java

Java is an object-oriented programming language. It is a statically typed and garbage-collected language that compiles to bytecode that runs on a virtual machine. It supports object-oriented and imperative programming. Compiling to bytecode for a virtual machine is the same model the JVM and .NET use: the VM, not the CPU, interprets or JIT-compiles the bytecode.

Java first appeared in 1995 and was designed by James Gosling and Sun Microsystems at Sun Microsystems. Today Java is one of the most widely used programming languages in the world.

Java in the language family tree

Java drew on ideas from C++, Simula, Ada, Smalltalk, and Mesa and went on to influence Kotlin, Scala, Groovy, C#, D, and JavaScript.

Sources: Wikipedia · Wikidata · Official site

Quick Facts

Compiler
javac is written in Java
Runtime
HotSpot JVM is written in C and C++
Standard library
Mostly Java
Compiled output
JVM bytecode

Java compiler vs JVM runtime

Java has a two-stage execution model that separates compilation from running. The javac compiler takes Java source files and produces class files containing JVM bytecode. Bytecode is a compact, platform-independent instruction set: the same class files run on Windows, Linux, and macOS without recompilation. Javac itself is written in Java and is part of the JDK (Java Development Kit). Because javac is a Java program, building a new version of javac requires an existing Java compiler.

Executing bytecode is a different job from compiling source. The HotSpot JVM, which is the production JVM in OpenJDK (and thus in Oracle JDK, Amazon Corretto, Eclipse Temurin, and others), is written primarily in C and C++. HotSpot includes an interpreter for cold code paths, a JIT compiler that compiles hot methods to native machine code, and a suite of garbage collectors. The JIT compiler observes which methods are called most often and optimizes those aggressively, including inlining call chains that would be expensive to analyze at compile time.

The Java standard library (java.lang, java.util, java.io, java.nio, and friends) is largely written in Java, though some classes have native methods that delegate to C or C++ for low-level OS integration. The combination gives Java its portability: application code and most of the standard library are bytecode that the JVM runs anywhere; only the JVM itself is platform-native code.

HotSpot JVM and modern JIT compilation

HotSpot's name comes from its original insight: most programs spend most of their time in a small fraction of their code. HotSpot monitors execution counts and compiles hot methods to native code using two JIT compilers: C1 (the client compiler, fast to compile but less optimized output) and C2 (the server compiler, slower to compile but generates heavily optimized native code). By default, methods start with the C1 tier and are promoted to C2 if they remain hot enough.

GraalVM is a JDK distribution that replaces the C2 compiler with Graal, a JIT written entirely in Java. Graal can apply more aggressive speculative optimizations because it can use the full Java type system to represent its internal analysis. GraalVM also offers Native Image, which AOT-compiles Java applications to self-contained native executables by running compilation offline, reducing startup time and memory footprint significantly.

Modern Java garbage collector options include: G1 (Garbage First, the default since Java 9, designed for large heaps with predictable pause targets), ZGC (concurrent, sub-millisecond pauses, available since Java 15, generational since Java 21), and Shenandoah (concurrent compaction, contributed by Red Hat). Each collector makes different tradeoffs between throughput, latency, and footprint.

Java implementation layers

LayerWritten inWhat it does
javacJavaCompiles Java source to JVM bytecode (.class files)
HotSpot JVM (interpreter + JIT)C and C++Executes bytecode; JIT-compiles hot methods to native code via C1 and C2
Graal JITJavaAlternative JIT in GraalVM; replaces C2 with a Java-written optimizing compiler
Java standard library (java.*)Java (with native stubs)Core APIs; some native methods delegate to C for OS calls
GC (G1, ZGC, Shenandoah)C++Memory management, running concurrently with application threads

Java release history

Java was created by James Gosling and colleagues at Sun Microsystems beginning in 1991, under the internal codename "Oak." The Green Project aimed to build a language for consumer electronics with a small footprint and platform independence. When the consumer electronics market did not materialize, the team pivoted to the web: Java 1.0 launched in January 1996 alongside the promise of "Write Once, Run Anywhere," backed by the first browser-embedded JVM.

Java 1.1 (1997) added inner classes, reflection, and JDBC. Java 1.2 (1998, branded Java 2) introduced the Collections framework and the Swing UI toolkit. Java 5 (2004, previously numbered 1.5) was the biggest language update before Java 8: generics, annotations, enum types, autoboxing, and the enhanced for loop. Java 8 (March 2014) added lambda expressions, the Stream API, and the new java.time package.

Oracle acquired Sun in 2010. Java 9 (September 2017) introduced the module system (Project Jigsaw) and shifted to a six-month release cadence. Since then, Java releases arrive in March and September, with Long-Term Support (LTS) versions every three years. LTS releases: Java 11 (September 2018), Java 17 (September 2021), Java 21 (September 2023). Pattern matching, sealed classes, records, and virtual threads (Project Loom) shipped across Java 14 through 21.

Frequently Asked Questions

What language is Java written in?
The Java compiler javac is written in Java. The HotSpot JVM runtime is written mainly in C and C++, and the Java standard library is largely written in Java.
What languages influenced Java?
Java was influenced by C++, Simula, Ada among others. See the influence section above for the full list.
Which languages did Java influence?
Java influenced Kotlin, Scala, Groovy among others.
Is Java self-hosting?
Yes, Java is self-hosting, its compiler can compile itself.
When was Java first released?
Java was first released in 1995. It was designed by James Gosling and Sun Microsystems.

Evidence Sources

Discover More

Embed this graph

Paste this iframe into any HTML page to show the Java relationship graph.

<iframe src="https://www.languagelineage.org/embed?lang=java" width="100%" height="500" loading="lazy" style="border:0" title="Java relationship graph"></iframe>

Please attribute the visualization to Language Lineage and link to the Java source record.

Explore Java in Graph →