Pages

JDK JRE JVM

 JDK, JRE, JVM.

jdk jre jvm
JDK JRE JVM

JDK = JRE + Development Toold

JRE = JVM + Library Classes 

JDK- Provide Environment To develop and Run Java Programme.

JRE- Provide Environment to only Run Java Programme.

JVM- Execute the Java Programme line by line.

Lets Deep Dive in JDK JRE and JVM.

Three abbreviations that can strike dread into the core of any sprouting Java coder. 

Well, maybe not fear but it's certainly confusing.

 So let's have a talk about it and figure out what these three acronyms are all about. We're talking about the JDK, the JRE, and the JVM and we're going to come to you and find out, what they all mean. 

So let's start with the JDK. Well the JDK stands for the JAVA Development Kit. And it's basically just that.

 It's the development kit that you need to create Java programs. There's a version for both Windows, Mac, and Linux. Basically, it's the tools that will take your Java source code, the code that you write, and convert them into a format that the JRE and the JVM, which we'll talk about shortly, can execute.

 So it incorporates things like debuggers for testing and for discovering mistakes in your code yet in addition to the Java Compiler for compiling that code. So that's the Java Development Kit. 

So proceeding onward, the following one is the JRE and JRE represents the Java Runtime Environment. 
So right off the bat, the Java Runtime Edition, the JRE activity incorporates the JVM, which is the Java Virtual Machine yet we'll speak increasingly about the JVM somewhat later. So what's remembered for the JRE and indeed, what's it about? 

Well the JRE, because you probably guessed by the word Runtime in the Java Runtime Environment, is used to run your Java program. So basically includes the libraries, set of different libraries that come with Java, the various functionality that you can basically execute in your Java code but also Java Launcher and I've mentioned, it also includes the Java Virtual Machine. And there's a version for that for Windows, Mac, and Linux as well and interestingly enough, the Java Development Kit comes bundled with a Java Runtime Edition as well. 

Now in previous versions that weren't the case and as a developer, you would have to have installed both versions on your computer but that's no longer the case. So basically with the Java Runtime Environment, any person who wants to run Java code has to have the JavaRuntime Edition installed on their computer to do so. Now the Java Runtime edition, just to be clear, doesn't include any development tools.

 So you can't develop programs with the Java Runtime Environment, you actually run the code that is created, if with the tools of the Java Development Kit, using the Java Runtime Edition. 

All right, so moving on, now before I start talking about the Java Virtual Machine, which is what the JVM stands for, you need to have a bit of an understanding of how traditional computer programming languages work. Now we take the example of C++. Now C++ Compiler, which compiles your C++ code, compiles it into the hardware or it makes it work with the hardware that it is currently being compiled on. So if you're running a C++ Compiler on your Windows Intel machine, it'll create a version, an executable version of the code, that'll execute only on an intel platform computer. You won't be able to take that executable code and run it on a different architecture machine like a Solaris unit machine for example.
So that's how traditional programming language is like a C++ virtually compile programs into that format. 



Now Java takes a different approach. The Java Virtual Machine, and this is part of the Java Runtime Environment, that's an effectively an abstract computing machine. That's really what it is. And the Java Virtual Machine, the JVM, knows nothing about the java programming language. All it knows that all it can do is work with compiled Java code. So essentially the Java Virtual Machine is more or less like a physical machine, but it's an abstract concept. 

So it's a virtual machine that sudden spikes in demand for your PC so when you really execute a program from the Java Runtime Environment, it runs this virtual machine. That's how your code's actually executed. And that probably sounds a bit confusing but essentially the JavaDevelopment Kit creates or takes the Java code that you've written and creates this class files. And those class files are actually executed or can be executed by the Java Virtual Machine. So that's basically the process the Java Development Kit takes the Java code that you've typed into your typical editor or IDE such as an Intellij, creates a class file, a .class file, that class file can be executed via the Java Runtime Environment in the Java Virtual Machine.

 And that's to mention that the Java Virtual Machine is bundled with Java, with the JRE, the Java Runtime Environment. Now in terms of the JavaRuntime Edition on the JVM, that runs on many devices. So basically what happens is, a manufacturer or vendor, someone who creates an operating system or whatever, they will actually produce a version of the JAVA Virtual Machine based on the specifications that I could have available and as soon as they do that and they implement that Java Virtual Machine, that means you can take your Java code and run it on their virtual machine. So this is how Java achieves the ability to run on so many different devices and so many operating systems, it's running a different Java machine which has been written for that particular operating system or machine, the hybrid as well.

 So I think that's a pretty interesting concept of how Oracle and actually Sun because they were the original creators of the Java product, how they built this concept of a virtual machine and from there you're running your code in a virtual machine and therefore it can run on any device or any operating system that actually has a version of the Java Virtual Machine, are generally utilized out in the business.

 All right, so that's really the concept. Now one other thing I'd like to address before we finish the video is the slowness. 'Cause if you think about it, C++ code is an example that produces native code. So in other words when you compile the code, it produces a version of that code that runs on that specific hardware and there's no obstruction layer. So its basically straight into that hardware and that's how C++ is actually going to run faster in general but a Java program, and again, that's because Java program is working on a Java Virtual Machine, so it's basically abstract in that concept the Java Virtual Machine is then producing the machine code that actually runs the actual code. 

So you can see these a two-step process with Java code as opposed to a one-step process with a C++ executable. So that's why, in the past, Java has been fairly slow or known as fairly slow and if you do any research you'll see that a lot of people still think that Java is extremely slow. But in general, Java is now a lot, a lot faster. A couple of reasons firstly there's a lot of efficiencies in optimizations that going on in Java Virtual Machines over that last probably 20, 25years that Java's been around but secondly computer hardware these days, is so much faster and so much more powerful that's really making the fact that it's a virtual machine running almost a non-issue. So if you're worried about Java being slower than perhaps traditional programming languages, more or less that feature has gone away and it's really only things like, your really intensive graphical applications, games and those sorts of things that you'll really notice the performance differences between saying C++, which is a common language for that sort of, those sort of applications, and Java. Right, so that's basically it, that's the overview.

So On Top Level---

JDK- Provide Environment To develop and Run Java Programme.

JRE- Provide Environment to only Run Java Programme.

JVM- Execute the Java Programme line by line.

 So hopefully now you understand the differences between the JDK, Java Development Kit, Java Runtime Environment, JRE and the JVM, Java Virtual Machine
All righty, so I hoped that helped. If you've got any questions, feel free to leave a comment and I'll get back to you.  

2 comments: