1995 was the year AOL floppy disks arrived in the mail, Netscape Navigator was born and the first public version of Java was released. Over the next two decades, Java witnessed the multi-core revolution, the birth of the cloud, and the rise of polyglot programming. It survived these upheavals by evolving with them, and it continues to evolve even as we celebrate Java's twentieth birthday this year.
But the JVM turning twenty doesn’t make it out-of-date. On the contrary, Java's evolution has lead to a kind of renaissance. That's why we sat down with RedMonk earlier this month to discuss Java's past, present, and future on the Opinionated Infrastructure Podcast. Our discussion centered around Java's role in a web native era, and how major businesses continue to adopt Java and alternative JVM Languages such as JRuby, Scala, Groovy and Clojure for their most critical systems.
In this post, we'll add context to the Podcast discussion and the Java renaissance by retracing the history of the JVM. It’s a story of timing, struggle, competition, community and openness. It contains lessons about software you can apply to your own organizations, and its path through history even hints at a vision for the future. Let’s take a look back at the first twenty years of Java.
Java began as an internal project at Sun Microsystems in the early 1990s. The company wanted to create a language for programming next-generation television sets and remote controls. But by the mid-1990s, it was already clear that the online-revolution was beginning. In 1995, the “Internet” and the “World-Wide-Web” became the same thing in most people’s minds. Yahoo! was founded, Powell’s Books started selling books online, and Pizza Hut launched an online delivery service. Fittingly, Sun changed direction to target the Web.
Java hit the ground running in May of 1995, and within five months Oracle, Toshiba, Mitsubishi, Macromedia and Borland bought licenses. But the most notable endorsement of Java came from Netscape, which included the Java runtime in it’s free browser. At its peak, Netscape’s usage share was close to 90-percent, which meant Java had its foot-in-the-door in a big way.
A few commercial products were built on Java’s Applets technology, but client-side Java never took off. Server-side programmers, however, loved the “Write Once, Run Anywhere” principle that Java embraced. They also benefited from Java’s automatic memory management, the absence of buffer overflow errors, and the rapid feedback provided by its interpreted runtime. The groundwork had been laid for Java on the server.
As Java matured, it became faster, more secure and more robust. Sun added a Just-In-Time (JIT) compiler, reflection and collections frameworks, database libraries, and the Swing graphical API. As a result, the runtime grew dramatically in size, which led to the release of Java 1.2 Micro Edition (J2ME), a compact runtime for mobile phones.
But then the bottom fell out of the market. The dot-com bubble burst -- hitting Sun hard. The company’s stock fell to $10 per share from a high of nearly $250 per share. This was the beginning of the end for the once great Silicon Valley heavyweight. But despite Sun’s financial trouble, new Java releases continued to offer performance and security improvements to the platform.
It was around this time that Sun created the Java Community Process (JCP) and the Java Certification Kit (JCK). The JCK was an effort to increase revenue from Java by charging alternative implementations, such as JRockit and Excelsior JET, for the right to call themselves “Java”.
The JCK, which exists today as the Technology Compatibility Kit (TCK), would end up having profound consequences on Java in the coming years.
As the 2000s rolled on, the industry recovered from the bubble and the JCP seemed to be functioning well. Java Specification Requests (JSRs) for the addition of features such as IPv6 support, regular expressions, assertions, logging APIs, and new I/O libraries were implemented and released in Java 1.4.
At about the same time, things were changing for chip manufacturers. Clock rate curves were flattening out, and the struggle to keep up with Moore’s Law became daunting. In 2004, Intel canceled its next-generation microprocessor project to focus on a dual-core chip. The future of the CPU was changing.
For software developers, the multi-core revolution signaled the end of the “free lunch”. Applications would no longer be able to leverage increasingly faster chips, without changing any code, to provide better performance.
Java reacted in a big way. In 2004, the release of Java 1.5 (a.k.a. Java 5.0) included an entirely new concurrency library. This new API and it’s underlying concurrency primitives made the JVM internals more efficient but also allowed Java developers to take advantage of multi-core CPUs within their applications. Java’s native threads, which could be scheduled by the operating system to run in parallel, made it possible for software performance to move in lock step with CPUs once again.
But the engineers at Sun were not the only programmers working on JVM internals. A growing number of alternative Java implementations were under development by BEA and IBM. BEA’s runtime, JRockit, included a management console (which exists today as Java Mission Control), deterministic garbage collection, multi-tier support channels, and an arguably better memory model.
The competition from these alternative JVMs led to improvements on all fronts. BEA, IBM and Sun challenged each other for dominance in the benchmarks of the day. The results included concurrent garbage collection, non-uniform memory access support, large page support, and heap compaction. Server-side Java performance was beginning to rival code written in C.
But as Java was taking the world by storm, Sun continued to be very bad at making money. The company reported a decline in revenue for 12th consecutive quarters. It also made its share of strategic blunders.
The release of Java 1.6 (a.k.a. Java 6) was the last major Java release for five years. Sun was bleeding and desperately trying to assert control over it’s most valuable asset: Java. As a result, the JCP began to fall apart when it’s members opposed Sun over a licensing dispute.
Sun’s Java License was too restrictive. It’s “field of use” clause prevented a truly open-source implementation of Java from being distributed by one of its licensees. This came to a head when the Apache Software Foundation (ASF) attempted to secure a license for its Harmony project. The end result was gridlock in the JCP, of which ASF was a member.
But as Java languished, a new crop of JVM-based languages emerged. These languages leverage the fact that Java code is compiled into bytecode that is executed by the JVM. Thus, language designers were able to write their own compilers to generate JVM bytecode.
One of the first, and most popular of these languages was JRuby. It exploited the concurrency features offered by the JVM to add new capabilities to the Ruby language, which was otherwise single-threaded. JRuby was soon followed by Groovy, Scala, Clojure and many others. Each language introduced features that were unique and unavailable in Java, allthewhile taking advantage of the performance and reliability of the JVM. Java was clearly still an industry leader, despite it’s lack of progress.
As if to confirm that Sun’s only strength was Java, the company renamed its stock ticker to JAVA in 2007. But it was too little too late. In the first quarter of 2008, Sun posted losses of $1.68 billion while revenue fell by 7%. That November, the company announced plans to lay off nearly 6,000 people (18% of its workforce). IBM was the first to flirt with buying the company. But the final suitor was Oracle, which purchased Sun in June 2009.
While Sun’s demise was slow and painful, the end result could be considered positive. The new JVM-based languages signaled a bright future for Java as a platform. And the foundation had been laid for a truly open source implementation of Java despite the JCP in-fighting. As the decade came to a close, things were looking up for Java.
In the wake of the JCP dispute over licensing, Sun created the OpenJDK project: an effort to implement a truly open source version of Java. While the engineers from Sun were settling into their new roles at Oracle, the OpenJDK project grew. By 2011, the project had the full support of Oracle, IBM, RedHat, Apple and others. These companies contributed better garbage collectors, management tools, and more. Open source Java had arrived.
Java had its first release under Oracle nearly two years after Sun’s acquisition. Java 7 was somewhat lackluster, but it was the first Java release in which the reference implementation was free and open source under the GNU GPL License.
One notable feature of Java 7 was a new bytecode instruction called invokedynamic. This instruction supported method invocations in the absence of static type information. Java is a statically typed language and couldn’t make use of this instruction in Java 7. It was created specifically for dynamic languages such as JRuby and Groovy. The addition of invokedynamic was the first indication that alternative languages would get first class support on the JVM.
Today, languages such as JRuby, Scala and Clojure are no longer considered emerging. They are used in production environments all over the globe. Developers adopt these languages to implement unique solutions to long standing problems. Business adopted these languages because they offer the same reliability and security as Java itself. The software world is changing, and Java is changing with it.
Nashorn is just one more example of how far Java has evolved since it’s early days. The JVM is a platform for a wide range of languages running on an even wider range of devices. Java is portable, flexible and open. And those are the characteristics that will define how it is used through the rest of the decade and beyond.
When Oracle purchased Sun, nearly 6 years ago, most developers were skeptical of how it would affect the future of Java. Would Oracle narrow the scope of it’s openness? Would they hinder the community’s ability to contribute JSRs? Thus far, Oracle has upheld Sun’s promise of an open JVM. Today, Java is more accessible than ever, and the community is larger and more vibrant than it was in the Sun years.
Oracle still maintains a strong grip on the “Java” name and API design, as demonstrated by the Oracle v. Google dispute, and the TCK is still a source of revenue. But Oracle has also funded extensive open source improvements to the OpenJDK project. Could Java be more open? Yes, but it’s hard to complain about it’s current status given the history we’ve reviewed. It has grown under Oracle -- both in openness and adoption.
Today, the JVM runs on an estimated 89% of computers, 3 billion mobile phones, and 125 million TV devices. There are 9 Million Java developers worldwide and Java is at the top of the TIOBE Index. But Java is not the only JVM Language on the list. The TIOBE Index includes Scala, Groovy and Clojure.
Alternative JVM languages are powering critical systems at Netflix, Twitter, LinkedIn, Square and Google. At Heroku, alternative JVM languages have become nearly as popular with our users as Java itself. Organizations are able to leverage these languages with little cost to tooling and without having to retrain an entire team of developers.
The Java language will always be the flagship of the platform, but the future of the JVM is polyglot programming. Software developers are no longer content to solve all problems with a single language. The JVM enables developers to choose the right tool for the job and allows those tools to interoperate using a consistent and robust platform.
While the languages used to implement JVM-based applications are growing, the JVM’s ability to run in more and more places is growing too. Java is powering the Internet of Things with it’s portability, and the next release of Java will further improve this capability. Project Jigsaw, a proposal for a modular JVM, will enable more compact runtimes that run on the smallest devices without giving up networking, database connectivity or other essential features.
Java has become more than just a language. It is a platform, an API, and a community. Businesses trust the JVM with their most important and sensitive technologies. This is due to it’s maturity, reliability and security. Java is at the precipice of the next-generation of software and hardware. No matter what trends emerge, developers and businesses will look to Java as a platform that can to create innovative products.