Even if APIs are copyrighted, anything that's copyrighted can be licensed, and OpenJDK, which includes the Java APIs, is licensed under an open source license (which, BTW, Google did not use in Android until recently, but have used, and still do, for their use of OpenJDK).