views:

109

answers:

4

i've bought a book "learning the java SE 6 platform". i wonder what the word platform really means. cause isn't it just a bunch of classes that i can use. the JDK 1.6 node in Netbeans under Libraries.

And what is API? isn´t it the same thing as platform. But doesnt library mean the same thing..a bunch of classes with some superclasses and so on?

+1  A: 

API - is a Application Programming Interface - this is a set of classes for use.
Platform is a whole bundle - API with runtime and additional applications like compiler, ect.

cetnar
+6  A: 

The Java platform consists (roughly) of the following:

  1. The Java programming language
  2. The Java API
  3. The Java Virtual Machine

There's a quite a bit of details in the Wikipedia article on Java (software platform).

The API, or application programming interface, alone provides the classes that come with the Java platform. For example, when one says the "Java API", one would probably be referring to the class libraries which come with the Java SE platform.

Just for the sake of providing links, here are the official documentation for each part of the Java platform:

coobird
what do JVM has to relations to JRE and JDK?
weng
The JVM runs Java applications. The JRE provides the JVM to run Java applications, while the JDK has a compiler which targets the JVM to compile Java applications.
coobird
Concise answer and to the point. The link below explains the different APIs that exist for Java. I'm not sure where the idea of framework fits into the picture.http://en.wikipedia.org/wiki/List_of_Java_APIs
James P.
sp basically JVM = JRE + JDK?
weng
@noname No. JRE = Core Java libraries + JVM. This is what you need to **run** Java software. JDK = JRE + developer tools (compiler, etc). This is what you need to **develop** and run Java software.
Pascal Thivent
JVM is what actually runs the Java applications. Java source code is compiled to Java bytecode which runs on the JVM. The JDK is different from the JRE, chiefly as it contains the Java compiler which creates the Java bytecode that runs on the JVM.
coobird
A: 

Yeah platform is more of a general term that can mean different things in different contexts. Think of a gaming platform like the XBox. In this case Microsoft provides a "platform" for developers to make games, and for people to play games on.

In the case of J2EE (enterprise Java), the term platform to me means a solution for developers to build enterprise applications. Its more than a set of classes as you pointed out. For example there are plenty of specifications such as JPA (for persistence), EJB etc. In these cases the Java developers have laid out a specification for other vendors to implement. I think of platform as a base that provides a variety of services on which to build something greater.

An API is a more technical a precise term. It stands for Application Programming Interface. An API is the interface that we developers use when using other people's software. Think of a Java String class. It has a length() method. All Jave developers know that this method exists for the String class, and it is thus part of the Java API.

darren
+4  A: 

The term "platform" is used to denote any collection of software, services and resources that, within a specific context, are considered a given so they can be used as building blocks for application software (or to build a higher level platform on top of that - something considered a platform in another context)

API is an acronym for application programming interface. This usually means the collection of calling conventions (function signatures and the like) that can be used by an application (the program you are writing) for perusing functionality residing inside a library or a platform.

An API is not the same as a library - the term Interface conveys that it only specifies what you can call, and how that behaves. The actual library that implements the interface can decide for itself how it delivers the specified functionality.

A good example of an API is for example the JDBC API - this is the standard way for java programs to communicate with databases. Each database vendor has its own protocol for connecting to the database, binding variables and such to database commands, but the JDBC API abstracts all that and defines a common ground what allows all java programs to use the same set of functions to talk to - ideally - any database. It is the database vendor's job to actually provide a driver, that is, implement a library that is in accordance with the API and knows how it can fulfill its tasks for that particular database system. So in this case you have many driver libraries (each vendor has their own, sometimes multiple ones) but they all deliver their functionality through the same set of functions, classes etc. specified by the API (in this case, the JDBC API - see http://java.sun.com/j2se/1.5.0/docs/api/java/sql/package-summary.html

Sometimes, an API is so extensive that it is considered a platform, but the term platform is more general, a platform does not need to be an API. For example, the collection of standard UNIX utilities like ls, grep, cd etc. can be considered a platform, but not so much an API.

Roland Bouman