Free open-source software began with high-technology tinkerers and researchers. Sharing code and ideas was their priority, not profits. In the tech industry, they were sometimes compared to socialists and communists.

Those days are long gone. Some of the communal idealism remains, but as open-source software is used more by big technology companies including I.B.M., Oracle, Hewlett-Packard, Google andApple — even Microsoft — it has also become a weapon in corporate warfare.

An unusually public salvo came this month, when Oracle sued Google, accusing it of copyright and patent infringement. Oracle claims that Google’s Android operating system for smartphones and other mobile devices is illegally using ideas and code from Java, a set of software tools initially developed bySun Microsystems in 1995. Oracle bought Sun in January,

Google denies the charges against Android, which is also open-source software, saying that it built the operating system and its own Java tools without using Sun’s intellectual property.

Google instead sees the suit as a move by Oracle to re-establish corporate control of Java, something that Sun’s executives were reluctant to do. “This action is not against Android per se but against any Java development not sanctioned by Oracle,” said Kent Walker, general counsel of Google. “The lawsuit is trying to put the genie back in the bottle.”

With open-source software, programmers can view the underlying source code and make modifications and fix bugs, as long as they abide by certain rules. Open-source programs are typically distributed free.

An estimated three-quarters of all open-source software is chugging away in service of the profit-seeking corporate world. It is used, in the form of the Linux operating system or the Apache Web server, to run data centers that power the Web.

Every company deploys open source differently as a tool to cut costs or as a weapon to gain an advantage over rivals.

The corporate battles are fought with software programmers who contribute to open-source programs, in the marketplace with sales campaigns and in standards bodies that govern open-source projects. The Oracle-Google clash is the exceptional case that ended up in court.

Their confrontation, according to Douglas Lea, a computer scientist at the State University of New York at Oswego, is a new front in what he calls “the open-source proxy wars,” in which big companies use open source to gain an upper hand in the commercial marketplace.

“It’s not so much good companies and bad companies in this kind of situation,” said Mr. Lea, a member of the executive committee of the Java Community Process, a group that defines Java features and standards. “These companies compete viciously and have different interests. And in this case, you have two corporations that champion different forms of open source.”

The roots of the Oracle suit go back well before Oracle acquired Sun. After Sun made Java open source in 2006 to broaden its adoption, its strategy was to let developers and companies freely use the Java technology deployed in data centers. Google was a major participant in contributing features and shaping standards for this so-called big Java in the Java Community Process, where Sun (now Oracle) retains the status of first among equals.

But Sun decided it would make money in the fast-growing field of cellphones with a set of software tools tailored for that market, called Java Micro Edition. This “small Java” is free for most developers, but Sun negotiates commercial licenses for big companies that want to make their own products. Licensees include Nokia, Research In Motion, Motorola, LG, Samsung, Vodafone and T-Mobile.

These licenses are individually negotiated, typically involve payments of tens of millions of dollars a year, and allow companies to modify code and not make those changes public, said a lawyer involved in rounds of these negotiations, who asked not to be named because the contracts were private.

Google took a different course in the cellphone business. In 2007, it founded the Open Handset Alliance and was joined by several cellphone makers and telecommunications companies. Its Android software is open source, under a different licensing model, and outside Oracle’s control.

“The dispute between Oracle and Google is really about control — Google’s ability to control the evolution of the Android technology,” said John Rizzo, vice president for technology strategy for the Aplix Corporation, which makes Java-based software tools. Aplix is a member of both the Open Handset Alliance and the Java Community Process.

Still, Google and Sun held talks over the last three years about reaching an agreement, but they made little progress. Sun prepared the basis of the lawsuit that Oracle eventually filed, and identified the seven patents that Oracle accuses Google of infringing, said a former Sun manager, who asked not to be identified because of the suit.

Sun eventually chose not to sue Google, the former Sun manager said, because it decided a patent lawsuit would undercut the company’s open-source efforts under Jonathan Schwartz, Sun’s chief executive who resigned in February after the Oracle acquisition.

In 2005, Sun released an open-source version of its Solaris operating system, which is used in data centers. Software patents are controversial, especially among open-source developers. If Sun filed a patent suit, the former manager said, Mr. Schwartz feared the move would alienate many open-source enthusiasts and potential customers, from Silicon Valley start-ups to governments around the world that are pursuing open-source initiatives.

The legal preparations were led by Noreen Krall, Sun’s former chief intellectual property counsel. Ms. Krall joined Apple this year as its senior director for intellectual property law and litigation. In March, Apple sued the cellphone maker HTC, saying its Android-based phone infringed on patents for Apple’s iPhone. Google was not sued, but Google issued a statement saying “we stand behind” the Android operating system and its industry partners.

With its purchase of Sun, “Oracle acquired a lawsuit it could bring,” said Eben Moglen, a law professor at Columbia who advises on free and open-source software projects. And Oracle’s chief executive, Lawrence J. Ellison, Professor Moglen added, is “taking advantage of this asset at a time when others are interested in fighting Android.” Mr. Ellison is a close friend of Apple’s chief executive, Steven P. Jobs.

Oracle is mainly a traditional commercial software company, making its money selling software licenses. Oracle supports Linux, but as a way to reduce the total hardware and software costs to customers using its database software, the company’s profit-making jewel. Oracle is pulling back from OpenSolaris.

For its part, Google is not in the traditional software business. Its model mimics broadcast television — its services (including software) are free, and it makes money on advertising.

The noncombatants — open-source developers — are hoping for an armistice between Oracle and Google, or at least a swift resolution to remove the uncertainty.

“It’s really hard to predict the consequences of big companies being nasty to each other,” said Mr. Lea, the university computer scientist
.