Is there hope for Java?

A judge has ordered Microsoft to make it easy for Sun's popular programming language to work with Windows. But the remedy may be too little, too late.

Published January 21, 2003 8:30PM (EST)

One Sunday in September 1996, Adam Bosworth, a respected Microsoft software engineer who headed the company's Internet Explorer division, wrote a long memo to several company executives, including Bill Gates. Bosworth knew that Gates, then the company's CEO, was about to go on one of his "Think Weeks" -- the monkish retreats during which he pondered Microsoft's long-term business strategies. In preparation for the week, Bosworth wanted to alert Gates to an emerging danger.

The threat, as Bosworth saw it, was Java, a programming language created by Sun Microsystems that allowed programmers to write code one time and run it on a number of different operating systems -- and securely over the Web -- without customizing it for each configuration of computer hardware and OS. "I think it is important to understand that Java is not just a language," Bosworth began. "If it were just a language, it would not be a threat to us. We would and could easily just build the best implementation of this language and be done. It is, however, much more. It is an alternative to COM" -- which happens to be the programming model on which Windows is based.

In the course of a thousand words or so, Bosworth explained how easy it was to program in Java. Doing many tasks in the Windows-Com model, using the C++ programming language, required "quite a lot of hard code" that was more cumbersome to write "than the Java equivalent," he wrote. There were some ways that Microsoft could fight Java, Bosworth surmised; one of them was to "quietly offer 'extensions'" to Java that would have the effect of making Java programs work better on Windows, or not at all on other platforms. He cautioned that this should be done "in ways that seduce rather than collide." Above all, Bosworth wrote, Microsoft had to realize the power of Java: "We must acknowledge that Java competes with COM in order to understand what to do about it, not just put our heads in the sand."

Bosworth's memo alarmed Gates. "This scares the hell out of me," he wrote the next day -- words that turned out to be embarrassing when they were eventually presented in the Justice Department's antitrust trial against Microsoft. (The e-mail thread is available in PDF format.) "It is very unclear to me what our [operating system] will offer to Java client applications code that will make them unique enough to preserve our market position. Understanding this is so important that it deserves top priority."

And so began Microsoft's effort to stifle Java. Details of its plan have since been exposed in three court cases, though specific conclusions regarding the legality of Microsoft's actions have yet to be reached. The latest scene is a federal district court in Maryland, where several companies are suing Microsoft for alleged damages stemming from its violation of antitrust laws. Ruling on a preliminary motion in that case in December, U.S. District Judge J. Frederick Motz ordered Microsoft to include a copy of Sun's Java "runtime environment" -- the software that allows a computer to run programs written in Java -- on "any product containing .Net," the nascent programming platform from Microsoft that is seen as a logical competitor to Java. On Wednesday, Motz gave Microsoft 120 days to begin shipping Sun's Java runtime in Windows. Microsoft says it will appeal the order.

Perhaps because it came during the holidays, and several years after the fight between Sun and Microsoft seemed relevant, response to the order was muted. Much of what was said about it reflected the dull he-said, she-said nature of complex corporate disputes; nobody in the industry expected Java to experience an explosion in popularity as a result of the ruling, nor for Microsoft to be brought to its knees. But if it holds, the ruling could mark a salutary event in the world of software -- the beginning of real competition between two pretty good programming schemes, each theoretically capable of running on multiple platforms. But it's also possible that the damage may already be done -- that Microsoft's early moves against Java sealed the fate of Sun's programming language and paved the way for Microsoft to take over yet another software market, with .Net.

Since its inception, Java has had mixed success. Not long after it was released, amid a storm of boom-era hype, Java was criticized for running very slowly on Windows, and -- because of Microsoft's actions, Sun contends -- the software still carries the burden of that first impression. But Java has made gains in non-Windows environments. The language is, according to some, the most widely used language for network servers and mobile devices. Sun estimates there are about 3 million Java developers, and Java has become a primary language taught in college computer science courses. There are no firm numbers, but Java could be the most popular programming language in the world. In other words, if Java -- a new, improved, fast version of Java -- finds itself on every copy of Windows, there won't be a shortage of developers to build Java-based Windows programs.

As the court documents show, Microsoft understands the threat from Java -- that's why it has prepared an alternative to Java called C# (pronounced "C sharp"). Part of the .Net Framework programming model, the C# language looks much like Java; Microsoft even says that, like Java, C# can run on non-Windows machines. To that end, the company has managed to get ECMA, a European standards body, to bless the language as being "open" and out of Microsoft's direct control. "You really are seeing a different way of working, from Microsoft's perspective," Anders Hejlsberg, the chief architect of C# at Microsoft, said last year.

Critics of Microsoft are not inclined to believe that the company has reformed; it's not in Microsoft's interest to see cross-platform languages flourish, and its past behavior proves it. But the beauty of Motz's decision is that the company itself may now be irrelevant. If Sun's Java and Microsoft's .Net are both supported on future versions of Windows, programmers will have the freedom to use whichever language fits their needs and not have to worry about whether users will have the software to run it. There may finally be a level playing field, and in that respect Motz's decision may be the first Microsoft antitrust ruling of any practical importance. Even if Java doesn't bring down Windows -- which might have been Sun's initial goal -- it might at least provide some competition to .Net. And in the world of Windows programming, competition would be a truly novel thing.

In the first week of December, when evidentiary hearings were scheduled in the Sun-Microsoft case, Baltimore was hit by its largest snowstorm in three years. Much of the city was shut down. But Judge Motz kept his courtroom open, asking the dozens of attorneys involved in the case to show up through the snow; according to one witness in the trial, the judge himself slept in his chambers one night to make sure he got to court in the morning. The 42-page ruling (PDF here) Motz issued a couple of weeks later speaks to that determination; it is, if there can be such a thing, a judicial tour de force. In a plain, first-person narrative, Motz goes through the sordid history of the battle between Sun and Microsoft over Java, grappling with each side's arguments and explaining rather elegantly why requiring Sun's Java in copies of Windows would be best for all parties involved.

Judges presiding over litigation involving complex technology often seem adrift in the jargon. Motz, though, gives the impression of someone well-schooled in Java and .Net, and his support of Sun's position -- he almost completely sides with Sun -- and rejection of Microsoft's is grounded in tech and business realities. His theory, in brief, is this: The sorry state of Java on desktop computers -- the "fragmented" market, in which most computers have old versions of the Java software, and some people have a bastardized, Microsoft-friendly version, causing developers to sour on the platform -- is probably the result of Microsoft's "anticompetitive conduct." Although the issue will be fully argued in an eventual trial, Microsoft, he says, appears to have used its Windows monopoly to destroy "Sun's channels of distribution" for Java; and now, having done that, Microsoft wants to introduce into this rigged marketplace its alternative to Java.

The only way to set the market right, Motz says, is to attempt to reverse Microsoft's actions. Requiring Microsoft to offer Sun's Java in Windows, he wrote, "is designed to prevent Microsoft from obtaining future advantage from its past wrongs and to correct the distortion in the marketplace that its violations of the antitrust laws have caused."

Who caused Java to fail on the Windows desktop? Of all the questions argued in the various trials involving Microsoft, this one is perhaps the most difficult to answer. Certainly, as the evidence shows, the people at Microsoft were intent on seeing Java fail. But many say that just because Java did fall flat on its face, and just because Microsoft pushed it a little here and there, one can't conclude that Microsoft deserves all the blame. Java, people point out, had a slow graphical interface and generally poor performance otherwise -- couldn't it have tripped up all on its own?

Greg DeMichillie, who used to work at Microsoft on its C#, C++ and Java programming applications, and who's now an analyst at the firm Directions on Microsoft, is one such skeptic. "There's a lot of people who say that Microsoft wanted to kill Java" because it was "write-once, run-anywhere," he says. "But really, people at Microsoft just thought that was a ridiculous notion, and they didn't pay any attention to it. They said, 'For technological reasons, we don't think write-once will work."

DeMichillie concedes that Microsoft added many "extensions" to Java in its programming environment that, when used in a program, would cause the program to run only on Windows. But he says that those extensions were put in to improve Java on Windows, not to pollute Java. "What they liked about Java was that it was easier to write applications in it. They liked it better as a programming language. And so they said, 'Let's make Java a good way to write a Windows application.' And of all the stuff that's been said of what Microsoft did to Java, it's good to point out that they did make a better version of Java. Microsoft does have some really sharp people, and they know Windows inside and out, and so if anyone were to make Java faster on Windows they were the ones to do it."

He also says that Microsoft did not do any of this quietly; Microsoft warned developers that its tools could result in Windows-only applications. "I remember they were very upfront about it," DeMichillie says. "When they came out with their Java tools that had Windows-specific features, they were very clear, in their communication with developers, that it was Windows-specific. The notion that Microsoft was trying to make people think they were building cross-platform applications when they weren't, that's not true."

Perhaps DeMichillie is right, but his version is not supported by the facts. In his opinion, Motz cites numerous internal Microsoft documents -- such as the Bosworth memo and Gates' reaction to it -- that suggest a company-wide effort to dupe developers into thinking they were building cross-platform programs that in truth ran only on Windows.

For example, Thomas Reardon, a Microsoft executive in charge of Internet operations, wrote in November 1996 that "We should just quietly grow [Microsoft's Java tools'] share and assume that people will take more advantage of our classes without ever realizing they are building win32-only java apps." Significantly, too, the findings of fact from the government's antitrust trial -- 412 very damaging statements about company behavior that may, in time, turn out to be the most important legacy of the never-ending federal case -- state that the company didn't start warning developers about compatibility issues with Microsoft's Java tools until 1998, when it was ordered to do so by a court. (Because those facts were set down during previous litigation, Microsoft has little room to re-argue them in this case; Motz presumed them to be true. In the past, though, Microsoft has argued that what executives write in e-mail doesn't necessarily reflect company policy.)

So the question lingers -- was Java on the desktop always broken, or did Microsoft break it? In the end, we may never get an answer; but as Sun will point out, it's telling that Java did well in all markets where Microsoft didn't have a monopoly. Why did that happen? Eight years after the introduction of Java, it seems clear: The language was successful because, some initial problems notwithstanding, it provided a much needed, innovative programming interface at just the right time.

Every month, TIOBE Software, a Dutch company that makes developer tools, publishes a survey of the most popular programming languages in use. The company uses Google to approximate the number of engineers who are expert in the language, the availability of courses taught in it, and how many companies sell software using the language. TIOBE comes up with a three-digit "rating" based on the count. Java is currently in first place, with a rating of 45.2; the next language, C, has a rating of 32.2, and C++, ranked third, has a rating of 24.6. C# is all the way down at number 9, with a 4.6 rating, one-tenth that of Java.

But the headline at the top of January's chart tells another story: "C# Still on Track to Become Number 1 Within 2 Years Time." According to TIOBE, the popularity of C# is rising faster than that any other language; Java is relatively steady. This shouldn't come as a surprise -- in a sense, it's to be expected, as more people are starting to use C# because it's new.

But the chart prompts two interesting questions: How did Java become so popular? And why is it not popular enough to beat out C#?

In the early 1990s, Sun Microsystems made what could have been an unfortunate business misstep; the company bet that the era of PCs -- a business in which Sun did not have much of a foothold -- was on the wane, and that the influence of the personal computer would quickly be eclipsed by that of consumer electronics devices like set-top boxes. (In retrospect, that hypothesis was early rather than wrong.) To take advantage of the new market, Sun sequestered about a dozen of its brightest engineers in an nondescript office park in Silicon Valley, telling them to come up with something. A year and a half later, they did: They'd built a device called StarSeven that could control a number of home appliances from the touch of a button; at its heart was Oak, a new programming language developed by a Sun engineer named James Gosling.

In time, Sun realized that the Internet, and not set-top boxes, would rule the new digital landscape; and by 1995, when Oak was renamed Java and officially released, the language was anointed as the first programming system of the Internet era. Sun basked in the Internet glory. Java, which was soon being released with the Netscape browser, could do Web animations, and for a while that was its main claim to fame.

The Java language was innovative in two main respects. First, Java is what's called an "interpreted language." There are many technical ways to define this, but essentially it means that a Java program doesn't give instructions directly to the machine it's running on; instead, Java code tells an "interpreter" what to do, and the interpreter then tells the computer. Interpretation is what allows Java to work on many different computer systems, from all flavors of PCs to mobile phones to large servers. To run a Java program on a specific system -- the Mars Pathfinder rover, say -- all one has to do is write an interpreter for that system. (It's the interpreter -- called the Sun Java Virtual Machine -- that Microsoft was ordered to carry in its products. Interpretation has also been blamed for Java's performance problems; but Sun and, now, Microsoft in .Net, have improved their interpreters to a point that there is often no significant performance penalty to Java and C#.)

Java was also interesting to programmers because it was one of the first easy-to-use "object oriented" languages. In the early 1990s, object orientation was the new wave of programming; it's beyond the scope of this article to get into the specifics of the technology, except to say that OOP, as it's called, is a design construct that helps programmers code small pieces of an application separately, breaking up the code into reusable bits called "classes" or "modules." (A good FAQ on OOP is here.)

Before Java, C++ was the foremost object-oriented language -- but, even though OOP was supposed to make programming easier, teaching object orientation in C++ was difficult. When Java was released, "the universities were in a superheated state," says Robert Harper, a computer scientist at Carnegie Mellon. "They were bursting for some alternative to C++, because they wanted to teach object-oriented programming, but using C++ for beginners is just cruel. So from an education point of view many people jumped on Java for their introductory courses." Several other professors said much the same thing; Java is thought to be the premier introductory language on college campuses, and advanced placement high school students use it as well.

Many people say that Microsoft's C# is just a variation of Java; it does some things better, some things not as well, but mostly the languages are very close. "C# is to Java as the Windows interface is to the Mac OS," Harper said.

Anders Hejlsberg, who designed C#, has acknowledged that the new Microsoft language is similar to Java; C# is also object-oriented and interpreted. But Hejlsberg also says that there are significant differences between the languages and that C#, and .Net, are improvements over Java.

According to various developers who've used both systems, the nicest thing about Microsoft's .Net is that it uses multiple languages. The system doesn't lock people in to one language, as the Java platform does; instead, developers can write code in almost anything -- whether in C++, C, C#, or even in Java -- and then have it all translated into what Microsoft calls the Common Language Runtime (CLR). It's this code that is run in an interpreter on your machine.

Miguel de Icaza, the co-founder of the open-source software company Ximian, leads the Mono Project, which has created a Linux version of .Net. He says the advantage of .Net is that it lets developers protect their "code investment." All the code they've already written in C++ or C can be translated -- or "compiled" -- to the CLR. Then, additions to the old code can be added with C#, which will also compile to CLR. Everything will work together as one application, even though many languages may have been used in the creation.

Conversely, "the Java solution to reuse your code investment is to throw everything out and do everything in Java," he said.

Some developers are OK with making that sacrifice in order to use Java, because they see .Net as having one big risk: It will become a Windows-only language. Microsoft denies this charge and points to the standardization of C# as proof. But Rick Ross, the founder of Javalobby, a Web forum for Java developers, said that although he's used C# and likes some aspects of it, he thinks of it as a "Windows-only" language.

What about projects to port .Net to other systems? "I don't expect those to come to fruition in the way that Java is cross-platform," he said, echoing the sentiments of many Java developers. "I know the amount of work that Sun has done to create portability: the fixing of bugs, really working hard to be cross-platform. And Microsoft is not doing that kind of work, and I don't think they'd dispute that. Only small parts of C# got standardized. So yeah, maybe you can you see C# on other platforms, but I wouldn't expect to build a cross-platform application."

But de Icaza disputes such claims. "There's a lot of crack being smoked," he said. "I'm going to tell you what it is -- there are very very very hard parts in .Net, extremely hard parts to do, and those are the things that got standardized. The binary file formats for .Net applications, that got standardized. Everything else that was easy didn't get standardized, but the important parts did."

As a consequence, he said, .Net on Linux is a reality, "and Mono is good proof of it. De Icaza said that Ximian is already coding some of its programs in C#, and he expects that in time its flagship programs -- like Evolution, the company's mail program -- will be coded, in part, in the .Net scheme.

But even so, de Icaza concedes that it will take a while to create applications in .Net for Windows that can also easily run on Linux in Mono. That's because key parts of what makes an application work in Windows aren't available in Mono. And some of those parts are very closely guarded pieces of the Microsoft empire -- so is it reasonable to expect the company to let that stuff go to other platforms? That's not likely.

When asked to guess whether C# or Java would be more popular in the long run, almost every programmer contacted for this article demurred -- and then waxed philosophical on the nature of languages. Programming languages, several said, are like religions; programmers grow accustomed to a language, or a family of languages, and despite all logic or argument or practical necessity, they will stick with it because it's what they know, what they believe in.

In the end, C# and Java are perhaps best analyzed in that light. They may be similar languages, but there's a philosophical gulf between the two. The people who ultimately choose Java will likely value compatibility over the performance gains you get from building a program specifically for one system. They'd prefer that everything ran everywhere, even if they have to lose their "code investment." The people who choose .Net may also care about going cross-platform, but they'd like some flexibility in the matter. They'd like to be able to build a program that runs only on Windows, so it works with all their other programs that also work only on Windows.

What will the majority choose? That question could have vast implications for the world of software. Not least would be the one that scared the hell out of Gates in 1996: If Java wins, and most programs run across all software, what use will any of us have for Windows anymore?


By Farhad Manjoo

Farhad Manjoo is a Salon staff writer and the author of True Enough: Learning to Live in a Post-Fact Society.

MORE FROM Farhad Manjoo


Related Topics ------------------------------------------

Microsoft