In June 1991, James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project. Java was originally designed for interactive television, but it was too advanced for the digital cable television industry at the time. The language was initially called Oak after an oak tree that stood outside Gosling's office. Later the project went by the name Green and was finally renamed Java, from Java coffee, the coffee from Indonesia.

On 23 May 1995, Java was originally developed by James Gosling at Sun Microsystems and released as a core component of Sun Microsystems' Java platform.

On 23 January 1996, Sun Microsystems released the first public implementation as Java 1.0, which promised Write Once, Run Anywhere (WORA) functionality, providing no-cost run-times on popular platforms.

On February 19, 1997, Sun Microsystems released JDK 1.1.

In 1997, Sun Microsystems approached the ISO/IEC JTC 1 standards body and later the Ecma International to formalize Java, but it soon withdrew from the process. Java remains a de facto standard, controlled through the Java Community Process.

In 1997, Sun sued Microsoft, claiming that the Microsoft implementation did not support RMI (Java Remote Method Invocation) or JNI (Java Native Interface) and had added platform-specific features of their own, as Sun's trademark license for usage of the Java brand insists that all implementations be compatible.

On December 8, 1998, Sun Microsystems released J2SE 1.2.

On May 8, 2000, Sun Microsystems released J2SE 1.3.

In 2001, After suing Microsoft in 1997, Sun won a settlement of US$20 million, as well as a court order enforcing the terms of the license from Sun. As a result, Microsoft no longer ships Java with Windows.

On February 6, 2002, Sun Microsystems released J2SE 1.4.

In 2004, generics were added to the Java language as part of J2SE 5.0.

On September 30, 2004, Sun Microsystems released J2SE 5.0.

In 2006, for marketing purposes, Sun renamed new J2 versions as Java EE (Enterprise Edition included technologies and APIs for enterprise applications typically run in server environments), Java ME (Micro Edition featured APIs optimized for mobile applications ), and The desktop version, J2SE, was renamed Java SE (Java Standard Edition).

On 13 November 2006, Sun Microsystems released much of its Java virtual machine (JVM) as free and open-source software (FOSS), under the terms of the GNU General Public License (GPL).

On December 11, 2006, Sun Microsystems released Java SE 6.

On 8 May 2007, Sun finished the process of Java virtual machine, making all of its core code available under free software/open-source distribution terms, aside from a small portion of code to which Sun did not hold the copyright.

As of May 2007, in compliance with the specifications of the Java Community Process, Sun had relicensed most of its Java technologies under the GNU General Public License. Meanwhile, others have developed alternative implementations of these Sun technologies, such as the GNU Compiler for Java (bytecode compiler), GNU Classpath (standard libraries), and IcedTea-Web (browser plugin for applets).

On 27 January 2010, Oracle acquired Sun Microsystems, becoming the owner of the official implementation of the Java SE platform.

On 2 April 2010, James Gosling, the creator of Java, resigned from Oracle, at the age of 55.

On July 28, 2011, Oracle released Java SE 7.

The use of Java-related technology in Android led to a legal dispute between Oracle and Google. On May 7, 2012, a San Francisco jury found that if APIs could be copyrighted, then Google had infringed Oracle's copyrights by the use of Java in Android devices.

On March 18, 2014, Oracle released Java SE 8.

District Judge William Haskell Alsup ruled on May 31, 2012, that APIs cannot be copyrighted, but this was reversed by the United States Court of Appeals for the Federal Circuit in May 2014.

In January 2016, Oracle announced that Java run-time environments, based on JDK 9, will discontinue the browser plugin, as, by late 2015, browser vendors were working on reducing plugin support in their products.

On May 26, 2016, the district court decided in favor of Google, ruling the copyright infringement of the Java API in Android constitutes fair use.

On September 21, 2017, Oracle released Java SE 9.

Java applets were programs that were embedded in other applications typically in a Web page displayed in a web browser. The Java applet, API, is now deprecated since Java 8 in 2017.

In March 2018, the last court decision, concerning the dispute between Google and Oracle, was overturned by the Appeals Court, which sent down the case of determining the damages to federal court in San Francisco.

On March 20, 2018, Oracle released Java SE 10.

On 25 September 2018, Java 11 was released, a currently supported long-term support (LTS) version.

In January 2019, Oracle released for the legacy Java 8 LTS the last free public update for commercial use, while it will otherwise still support Java 8 with public updates for personal use up to at least December 2020.

In January 2019, Google filed a petition for a writ of certiorari with the Supreme Court of the United States to challenge the two rulings that were made by the Appeals Court towards Oracle's favor.

On March 19, 2019, Sun Microsystems released Java SE 12.

On September 17, 2019, Sun Microsystems released Java SE 13.

On 17 March 2020, Java 14, the latest version of Java, was released.