13

The question may at first sound silly, but maybe it isn't at all.

  • Java is not the Java language, most people know that, since you can program Java with lots of other langauges like Scala or Groovy

  • Java is not a concrete VM implementation since there are other implementation out there, not only SUN's, Microsoft's or IBM's.

  • Java is not the class framework since many implementation add or leave out classes at will.

  • It isn't even that a common VM specification or even Java bytecode must be used, see Dalvik VM

  • Maybe it is just a set of principles they share, whatever this may be. It definitely is not "Write once, run everywhere" since this isn't the case for at least Dalvik and Microsoft VM/J#.

So the question is, what exactly is Java? Is there even an exact definition?

EDIT Lots of people seem to have the opinion that java only means the programming language. So a java-enabled mobile phone must be a phone which enables the user to use programs consisting of class files created with the java language only. If this would be true, the java virtual machine / java runtime environment / java development kit would be made for java only and other jvm languages would have their own corresponding xvm / xre / xdk.

Seki
  • 11,135
  • 7
  • 46
  • 70
codymanix
  • 28,510
  • 21
  • 92
  • 151
  • 6
    +1 Definitely no silly question. – helpermethod Nov 12 '10 at 16:43
  • 2
    As far as the question about no common VM spec, that's untrue as I've linked to it in my comment on Andrzej's answer. The Dalvik VM is not claiming to be a JVM. (Granted Oracle is currently suing Google over this point.) – Poindexter Nov 12 '10 at 17:08
  • http://www.jwz.org/doc/java.html: The fact is that there are four completely different things that go by the name ``Java'': A language; An enormous class library; A virtual machine; A security model. – Daniel Voina Nov 12 '10 at 17:15
  • 2
    @Daniel: The language is "Java". I would argue that the other 3 items fall under the JVM which is something different. The JVM may have started as simply an implementation of Java, but it has grown into something different. Calling it the "Java" Virtual Machine is something of a misnomer anymore as evidenced by the plethora of JVM languages. – Poindexter Nov 12 '10 at 17:20
  • 2
    @Daniel Voina you forgot to mention the 5th the island. :) – Octavian Helm Nov 12 '10 at 17:28
  • I'd argue "Java" is a marketing term, which, depending upon context (and salesman), encompasses one or more of the "technologies" in the question. There is *Java* Language (per the JLS), *Java* EE SDK, *Java* Bytecode, Sun *Java* Hotspot VM, etc... –  Nov 12 '10 at 18:00
  • @Octavian Damiean: also a coffee... – Daniel Voina Nov 15 '10 at 17:42
  • @Pointdexter: Java name gives less tongue fractures than JDK an can be well used as a mnemonic hence its commercial success. – Daniel Voina Nov 15 '10 at 17:52

7 Answers7

39

Java is the Java language, actually. Groovy, Scala et al compile down to equivalent bytecode that can run on the JVM, but they aren't Java.

Formally, I'd say that Java is the JLS.

Andrzej Doyle
  • 102,507
  • 33
  • 189
  • 228
  • 7
    +1 This is absolutely the correct answer. The Specification is everything to a language. Everything else is just implementation details. – Poindexter Nov 12 '10 at 16:39
  • @Poindexter: Your statement only holds true if Java is a language. :) – MicSim Nov 12 '10 at 16:46
  • 3
    @McSim: I would argue that the term "Java" refers to the language. The "Java Virtual Machine (JVM)" is a related but entirely seperate entity. The JVM has a seperate language (the bytecode) and has a seperate specification: http://java.sun.com/docs/books/jvms/ – Poindexter Nov 12 '10 at 16:54
  • This is plain wrong, why is this so often voted up? You are saying that the jdk, jre, groovy and scala is *not* a part of java? – codymanix Nov 14 '10 at 00:38
  • 3
    @codymanix Yes, that's my opinion. Scala, Groovy and Clojure are not part of Java. – JAL Nov 14 '10 at 19:54
  • Even if I don't agree with that answer I accept it, because, since the term java seem to obviously not officially well defined, so it boils down on what most people understand as java. Just to get this thing closed for me :) – codymanix Nov 26 '10 at 17:10
  • Right on spot. All the other things like piggy-back languages, SDKs and JVMs make up the Java *ecosystem*, centered around the Java Language Specification. – hiergiltdiestfu Jun 13 '15 at 12:03
6

Java is a programming language. The syntax part.

Luca Matteis
  • 29,161
  • 19
  • 114
  • 169
5

In my opinion it's the language. I don't think people say they're programming Java with Groovy, or if they do, they are being inaccurate.

waxwing
  • 18,547
  • 8
  • 66
  • 82
5

Strictly speaking Java is just a programming language. But it's a programming language that includes many, many standards: for example many API’s and JVM specifications. That's why SUN and others refer to it as a platform.

Other languages like Scala, Ruby, etc. are not Java, they just compile to byte code that runs in a Java Virtual Machine. They are just build on top of the Java platform, but are themselves not Java.

The JVM is highly standardized and many companies can and do offer their own implementations for their hardware platforms. This is not Java either, these are just implementations of a part of the Java platform.

The Java VM specification is 100% standardized something that is enforced by Oracle as they claim copyright on Java. That’s why the Android (Dalvik VM) is currently the subject of a court case of Oracle against Google.

Kdeveloper
  • 13,679
  • 11
  • 41
  • 49
3

Actually, it depends on the context where the word is used. It's all: syntax, technology, framework, programming language.

As a sidenote, Oracle answers this question as follows: What is Java?

MicSim
  • 26,265
  • 16
  • 90
  • 133
2

You cannot say that Scala is Java any more than you can say that a fork is a comb just because you happen to be brushing your hair with it. Or, if I may bring up the classic analogy, driving nails with your wrench doesn't make it a hammer.

You can make a compiler that compiles COBOL into C++ if you want, but that doesn't mean COBOL is C++.

Many languages have x86 machine code as their target compiled language, so does this mean they are all the same thing?

It doesn't matter if other languages can compile to the JVM's bytecode, nor does it matter that you can compile Java into a specific architecture's machine code. The JVM is still Java's platform; other languages just happen to share it, and Java just happens to be able to compile to targets other than JVM bytecode. The same way as a fork just happens to be able to comb your hair depending on how you handle it.

I think this is a silly question (and has nothing to do with programming besides). Is it possible for someone to act like a renaissance philosopher and try to argue that your fork is actually a comb because you have never, ever used it as a fork and always use it only in your hair? Sure, go ahead and argue, and maybe you'll even have a point, but hopefully nobody wastes their time listening to it. This is all just a game of semantics, and once you start arguing about semantics everybody loses.

(edit) Bah! I just realized I'm arguing about semantics!

Loduwijk
  • 1,950
  • 1
  • 16
  • 28
  • Oh no, if COBOL turning into native code and C++ turning into native code means COBOL is C++, then HipHop turned C++ into PHP!! – JAL Nov 14 '10 at 19:55
1

Most people see Java as the programming language (as defined by the Java Language Specification). But there are plenty of others who split it into the Programming Language, the various VMs and the larger ecosystem.

There are also legal definitions of what can be called Java (e.g. The trademark), but I think I'm going to leave that one alone at the moment :-)

Martijn Verburg
  • 3,287
  • 21
  • 26