Is it Java? February 26, 2007
Posted by WarpedJavaGuy in java, programming.trackback
If it loads into a JVM then it is Java.
The Java phenomenon has given rise to an ever increasing number of Java programs being created, executed, and observed. About infinity minus one programs perhaps, for there is always a need for another. Consequentially we know that Java is real. We also know that Java is an object oriented and platform independent programming language for developing programs that can execute on any platform that has a Java Virtual Machine (JVM). Collectively this means that Java is not just a programming language, but rather a common platform for developing and executing portable programs.
Identifying Java programs is something we all know and take for granted. We write Java code and compile Java programs every day. We compile .java source files into .class binary files. These files contain Java bytecode that can be loaded into JVMs and interpreted for execution on underlying native platforms. They are what constitute Java programs.
So how do we know that a program is a Java program? Take an arbitrary .class file for instance. Is it Java or not? If it does not start with CAFEBABE, then it is not Java. But if it does, is it necessarily Java? If it is not, then what is it and why does it bear this number? Is it just a bogus file with a .class extension? What would happen if we tried to execute it? Would it execute or not, and if so what would it do? It would do what it was programmed to do. If it successfully loads into a JVM then it is Java.
![]()
What about Java source code compiled to a native binary? Was that Java? I like your thinking, that it’s the platform not the language that matters here. Just throwing a spanner in the works a bit!