Highflying Google Inc. joined hands yesterday with a former Silicon Valley powerhouse, Sun Microsystems Inc., in a deal that analysts say is designed to attack a common enemy: Microsoft Corp.

On the surface, the deal is a relatively commonplace agreement between two companies to distribute software.

Google's "toolbar" of applications, with its buttons for search, news, pop-up-ad blocking and other features, will be available in downloads of Sun's Java software. Java is required for certain games and other online interactive features and allows them to work regardless of which device or operating system a consumer is using.

New or updated Java code is downloaded about 20 million times a month, Sun chief executive Scott G. McNealy said, so the deal will boost Google's toolbar distribution as it competes against versions by Microsoft and Yahoo.

Google will pay the struggling Sun for the toolbar download option, as well as buy more Sun hardware and software, though payment terms were not disclosed.

But the agreement "is like an iceberg," said John R. Rymer, an analyst with Forrester Research Inc. "There's undoubtedly discussions [behind the scenes] . . . that could be vastly more interesting."

For example, without committing to specifics, top Sun and Google executives said they will explore opportunities to "promote and enhance" Sun's suite of office software, which includes word processing and spreadsheets.

Were Google to use its desktop popularity as a vehicle to distribute Sun's StarOffice, or its open-source sibling OpenOffice, it would be the most serious challenge to date of Microsoft's hegemony in the personal computer office program market.

Microsoft Office is one of the software giant's cash cows. OpenOffice and StarOffice are among a handful of alternatives available for download, none of which has gained traction.

Jonathan I. Schwartz, Sun's chief operating officer, said in an interview that his company hopes Google's promotion of OpenOffice will create a "safe alternative to the proprietary world" of Microsoft.

The broader goal, McNealy said at a news conference, is to make software a service distributed online, supported by the network rather than dependent on Microsoft's Windows operating system.

Java also is a set of tools developers use to write Web applications, in competition with Microsoft, which did not return calls seeking comment.

Ray Valdes, an analyst with market research firm Gartner Inc., said Google's popular e-mail service, Gmail, has demonstrated that a full-feature program can function via the Internet without additional support from the computer's operating system.

"I don't see office as being the endgame for Google," he said. "It's just one of multiple initiatives . . . some have nothing to do with Microsoft, and others put them right into competition with them."

Walt Scacchi, director of the Institute for Software Research at the University of California at Irvine, said Google is "highly motivated to try to make the Web more the platform."

Scott G. McNealy, left, and Eric E. Schmidt, chief executives of Sun and Google, respectively, at a conference announcing their new partnership.