Post 2: JVM, JRE and Java

When programming in, the key things to know where CLR, the common language runtime, which was the core engine to execute .net programs. The .NET Framework, which consisted of framework class library, libraries for WinForm applications, ASP.NET applications, ADO.NET, WPF, WCF, XAML, LinQ, TPL etc. essentially everything that is required to run a .net application. Finally, one needed a language to code for .NET platform so languages like C# or VB.NET or even J#.

C# came into existence along with, but over the years they have not kept the same versioning scheme. C# has typically incremented with major versions and current version is 6.0, while the .net framework is at version 4.6.1.

Parallel in Java world, we have JVM (java virtual machine), acting as the host for java programs, a JRE (java run time environment) which is necessary code/libraries to run a java program and finally is java, the language itself. The current JRE is 8u74 and the latest java version available is 8.0. Needless to say that JRE and java version you use, should be compatible with each other.

Lot of applications out there continue to use and even new ones are still being built using java 7.0. There are interesting new features in java 8, but probaly not compelling enough for existing applications to start using it and undergo another cycle of testing to make sure all is well.

Interestingly the first java code I was debugging, dealt with Calendar class. For some reporting requirement, there was a need to get data of current month. In the code I noticed that the developer had done something like Calendar.MONTH - 1 and I felt that this was the reason we weren't getting the correct result. Why subtract 1 from the current month, when we wanted data of current month? It was then that I realized that in java, this Calendar class actually has months starting from 0, so January actually means month 0, February as month 1 and so on till December which is month 11. Strange, but then it seems that this is a pretty ancient class (written in early days of java) and used Gregorian and Julian calendars as a basis for date time calculations and as per those calendars January was month 0. The newer DateUtils class provided by Apache.commons library have addressed this issue, which has troubled many a first timers like me.

Another subtle convention difference I noticed is that in C# when we talk of class file, we are typically talking about the .cs code file. The compiled code is an EXE or a DLL. In java world, java file refers to the code file and the java class file is the compiled .class file. These class files are typically deployed zipped together as part of a JAR file.

That clears up the basics of JVM, JRE and Java. In next post we will take a closer look at Eclipse. 


Popular posts from this blog

Travelogue: Day trip to Places near Pune

Getting my Passport reissued

Travelogue: Jal Srushti Island Resort