SAN FRANCISCO — Two former chiefs of Sun Microsystems offered opposing views of their company’s software policies Thursday, while attorneys engaged in some of the most colorful cross-examination that jurors have witnessed in the high-stakes trial over Google’s (GOOG) use of Sun’s Java programming tools.

Google is being sued by tech rival Oracle (ORCL), which bought the once-powerful Sun two years ago after Sun’s business fell on hard times. Appearing after several other high-profile witnesses, former Sun CEOs Jonathan Schwartz and Scott McNealy took center stage Thursday in the highly public dispute over Google’s popular Android mobile software.

Called to testify for Google, Schwartz gave a strong endorsement of Google’s argument that it was free to use Sun’s Java computer language and related elements when Google built Android, now the leading smartphone operating system in the world.

But McNealy, who was Sun’s co-founder and CEO before Schwartz, testified for Oracle that Sun did not allow other companies to use key elements of Java technology without a license agreement to make sure they didn’t create incompatible programs. McNealy was also Schwartz’s boss and served as chairman when Schwartz was CEO.

Google did not get a license for Java, after the two companies negotiated over a partnership but never reached an agreement. Now Oracle is alleging that Google violated Java patents and copyrights that Oracle acquired when it bought Sun.

With the trial nearing the end of its second week, jurors have endured hours of dry testimony about the technical details of computer programming. That changed Thursday, as attorneys grilled the two key witnesses.

Schwartz, who had publicly congratulated Google when it launched Android, drew sharp sarcasm from an Oracle attorney when the former CEO said his position on the use of Java was based more on his understanding of business “realities” than on specific legal knowledge.

“Ohhh, I’m sorry. I used up some time I did not need to use,” Oracle attorney Michael Jacobs said loudly, in a mocking tone that sought to dismiss Schwartz’s testimony as carrying little weight in the current legal dispute.

Jacobs later sought to undercut Schwartz further by getting him to acknowledge that Sun struggled financially when Schwartz was CEO and by suggesting that Schwartz was essentially forced out when Oracle bought the company.

Google attorney Robert Van Nest, meanwhile, tried to discount McNealy’s testimony by suggesting he is a good friend of Larry Ellison, the multibillionaire CEO of Oracle. Under cross-examination, McNealy also acknowledged that he earned $150 million to $200 million from his Sun holdings after the Oracle acquisition.

“You once referred to Mr. Ellison as a national economic hero,” Van Nest barked at McNealy.

“That’s correct. Anybody who pays that much in taxes is a national economic hero,” McNealy responded with the deadpan humor for which he was known at Sun.

While McNealy’s testified for 45 minutes, Schwartz testified for more than twice that time. Sporting his trademark ponytail, Schwartz was animated and enthusiastic as he turned toward the jury and spoke at length about software issues and strategy, while offering several strong statements to bolster Google’s case.

Schwartz told jurors that Google was free to use the Java programming language and related elements known as application programming interfaces, or APIs, which Oracle has claimed as proprietary technology. He added that Sun wanted other programmers to use the Java language and APIs, since that would promote the use of other Sun products.

Google would need a license only if it tried to use the Java trademark, Schwartz testified. While acknowledging that he had hoped Google would negotiate such an agreement, he told jurors that Sun couldn’t stop Google from releasing Android on its own. Schwartz added that as CEO he made a decision not to sue Google, “because we didn’t feel we had any grounds.”

McNealy, however, told jurors that he viewed the APIs as separate from the programming language and more like a blueprint — a view that echoes Oracle’s argument that the APIs are creative works protected by copyright.

Oracle lawyers also enlisted McNealy in their effort to minimize Schwartz’s testimony by asking about a blog posting in which Schwartz had applauded Google’s release of Android. While Schwartz had described his blog as an official outlet for him to express company policy, McNealy said it was not.

“If you won’t tell him,” McNealy cracked, testifying after Schwartz had left the courtroom, “I was busy and didn’t read it.”

Contact Brandon Bailey at 408-920-5022; follow him at Twitter.com/BrandonBailey.

More in News

Otto Warmbier was arrested in January 2016 at the end of a brief tourist visit to North Korea. He had been medically evacuated and was being treated at the University of Cincinnati Medical Center when he died at age 22.