Taking the stand on Tuesday during the ongoing trial over Google's use of the Java programming language on its Android mobile operating system, Google executive chairman and former CEO Eric Schmidt strongly defended the company against accusations that it illegally lifted parts of the Java platform from Sun Microsystems.

"My understanding was what we were doing was permissible," Schmidt said. "From the sum of my experiences and interactions, I was very sure what we were doing was legally correct."

After purchasing Sun Microsystems in 2010, software giant Oracle sued Google over Android's use of Java, claiming patent and copyright infringement. The trial kicked off last week at a federal court in San Francisco, and Schmidt is among many big tech names to testify, including current Google CEO Larry Page and Oracle boss Larry Ellison.

While Sun was developing Java, Schmidt was the company's chief technology officer. In court on Tuesday, he went so far as to call the release of Java a "religious moment." Following Java's release, he took over as Google CEO, and in 2005, the search giant purchased a startup called Android that was developing a mobile operating system.

According to Schmidt, he and co-founders Larry Page and Sergey Brin began looking for ways to put the platform on mobile devices. In "typical Google fashion," he said, they only had a vague idea of what they would do with the platform, but they knew that they needed to become competitive in the mobile market quickly. "At the time, we were quite concerned with Microsoft's products," Schmidt said. "It's hard to relate to that now. This is before the iPhone revolution occurred."

At some point, Google decided that the best way to run applications atop the OS was with Java. In a 2010 e-mail entered into evidence by Oracle, Google engineer Tim Lindholm told others at the company that he had looked at alternatives to Java and that "they all suck." And in another 2005 e-mail – also admitted by Oracle – Android head Andy Rubin tells others Googlers that the company must either partner with Sun or buy a Java license in order to use the language atop Android.

With its case, Oracle intends to show that although Google realized it needed a license, that it did not acquire one, and that it then illegally mimicked – or even copied – Sun code when building the application program interfaces (API) for Android. APIs are akin to an instruction manual for computer code, and Oracle claims that Google violated its copyrights in building 37 of these APIs.

On Tuesday, Schmidt said that Google did not need a license to create its own version of Java. But Oracle counsel David Boies said that Google was the only company using Java's APIs without a license, and he inferred that Google had always intended to utilize the Sun's Java APIs. Schmidt said that Google had planned to use Java from the start of the Android project, but he also said that he didn't agree with the vocabulary Boies used in describing the Java programming language and platform.

"An interface is a specification. A name," Schmidt said curtly. "There's a collection of those names that forms the standard that Java uses. We, Google, implemented those interfaces in our own way."

"Just to be clear," Boies responded, "you copied the 37 Sun Java API specifications?"

"We used the interface names, which is how one does this, and then did our own implementation of those services," Schmidt said.

"Are you saying is that the only thing you copied was the names?" Boies asked. And Schmidt said "yes."

Boies then asked for further technical details, but Schmidt said he wasn't briefed on these details. He even said he does not know about the technology compatibility kit (TCK) license – a license that ensures Java application still works with alternatives to Sun Java platform – because it wasn't around when he was at Sun. "We're talking over 20 years. Things change," he said.

But Schmidt did recount his discussions as Google CEO with Sun's then-CEO Scott McNealy over a potential partnership on Android. These discussions were mentioned earlier in the trial, and according to Schmidt, Google and Sun looked at ways to jointly develop pieces of the mobile operating system. But the negotiations quickly reached an impasse.

"I'm worried about how we're going to replace the revenue," read a piece of e-mail evidence written by McNealy. "This is likey going to submarine."

Schmidt called this a typical Sun response. "I interpreted this as, 'We need money from you,'" he said. "[McNealy] understood the value of a billion users." Later, negotiations broke down as it became clear Sun would not allow Google to touch the Java source code. This was the main issue, Schmidt said, not the $30 to $50 million Sun wanted for the partnership. "We would have paid that," he said.

So Google began what it calls a "clean room implementation" of Java, ostensibly working from scratch to build a new version of the Java platform on its own. Prior to Schmidt taking the stand, Android boss Andy Rubin testified for the second day running, and Oracle's Boies asked whether Google had truly created a clean room version of Java. In an e-mail from the time Google was originally developing Android, Rubin told other Googlers: "I think a clean room implementation is unlikely because of prior knowledge.... Anyone with specific knowledge especially those from Sun are tainted and would be bad."

On Tuesday, Rubin sidestepped many of the questions because, he said, he was confused about the vocabulary Oracle's counsel was using, especially the word "fragmentation." Bries was attempting to show that Google was aware that it "fragmenting" the Java platform in creating a new version of the platform on Android.

According to Schmidt, in building its version of the Java platform – known as the Dalvik virtual machine – Google's team of engineers did not run afoul of the law. "It involved a team that didn't use Sun's intellectual property, so I was told," Schmidt said. "[Sun] was extremely aware of our implementation."

Schmidt said that Jonathan Schwartz – who took over as CEO of Sun when Scott McNeely stepped down – was aware that Google was using Java, had no objections, and never said Google needed a license. Robert Van Nest, Google's lead counsel, displayed a blog post from Schwartz that encouraged Google's Android work.

After Schmidt left the stand, Oracle rested its case in the copyright phase of the trial. (Google then recalled him for their case). Two more phases – focused on Oracle's patent accusations and damages Google may be required to pay – are still to come.

Correction: This article has been modified to correct the year of the 2010 Tim Lindholm e-mail