This content originally appeared on Level Up Coding - Medium and was authored by Emmanuel Tejeda
Understanding the core fundamentals of how java works.
As a full stack software developer, I went through a 12-week training program. During the training, I was asked basic and advanced questions related to Java and other services. One of the questions that stumped me and some of my collogues was, “What is Java?”. Almost everyone that has worked in a computer science related field knows about Java. Some have learned how to use the programming language associated with Java. Despite how common Java is in my field. I was shocked to realize that I could only give a surface level answer to this question. So, I did some research.
If you ask someone who has worked with java, “what is java”? They will tell you something like, “Java is a high-level, class-based, object-oriented programming language”. If you're like me, you would have thought that was all there was to it. Java is in fact a language used to create applications. But after my research, I learned that this explanation is very shallow. It does not do justice to what the creators of Java have accomplished
If you have ever taken a computer science course or sat down for an interview. You have most likely heard of the JDK, the JRE, and the JVM. These three tools are available in almost every machine that has Java running inside of it. They allow you to create, compile and run your java applications. If you want to understand what Java is. You need to understand how these tools contribute to creating your applications.
The JDK
Let’s start with the JDK. The JDK stands for the Java Development Kit. As the name suggests, the JDK provides the tools needed to create a java application. It takes your java source code and converts it into a format that the JRE and JVM can understand. It comes with the debugger, which informs us of errors when we try to compile our code. And the compiler itself, which turns our code into a format the JRE and the JVM can understand.
The JRE
Next, we have the JRE. The JRE stands for the Java Runtime Environment. The JRE gives our machine the ability to run our java program. It includes libraries that give our java applications certain functionalities. Like the JDBC, which stores and manages data. The JRE also comes with the Java launcher and the JVM. The Java launcher allows us to run our Java applications along with the JVM.
The JVM
Finally, we have the JVM. The JVM stands for the Java Virtual Machine. But before moving any further. It’s important to understand how other traditional computer programming languages work. This will help us better understand how the JVM works. Let’s take a popular Object-Oriented programming language like C++. When you try to run a C++ program, it uses the C++ compiler. This compiler then transforms your C++ code to a format your processor can understand. For example, if you were to run your C++ code on an intel machine. The compiler would output your code in a format the intel machine could understand. It would replicate this process for whatever machine you are using. Like PowerPC and Mac, or Linux and AMD
Understanding the JVM
This occurs because most processors do not share a common machine code. Machine code is used to control a computer’s central processing unit or CPU. If you had machine code for an intel machine and then gave those same instructions to a AMD machine. It wouldn’t know what to do with them. C++ today does that for you in the background. Before C++, Java, and other modern high-level languages. Individuals or companies would buy many compilers to run the same code on different machines. This would create compatibility issues at times, and compilers were not cheap. Java sought to fix this issue using the JVM. The JVM resides in your RAM (Why Is RAM so Important? (reference.com), it takes the code your Java compiler created, processes it, and converts it to the appropriate machine code. This process eliminates the need for many compilers.
The difference between C++ and Java is that. Unlike C++ which gives those instructions directly to your processor. Java has to go through the JVM, then to the processor. This process in the past would make Java slower than C++, as Java required an extra step to run the same code. Today with the power and speed of our computers, that speed gap is largely irrelevant.
Thats the basics of the JDK, JRE, and JVM. If you would like further explanation, or a video format to listen to. Here are some links that helped me understand these concepts. You could also leave a comment in the article, and I will try to respond to the best of my abilities. Also, look forward to more articles like this in the future. Be on the lookout for video formats of these concepts in the future.
Have a great day!
What is Java? — Java Programming Tutorial — YouTube
JDK, JRE, JVM: What Are They and What Are Their Differences? — YouTube
What is Java? The JDK, JRE, and JVM. was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.
This content originally appeared on Level Up Coding - Medium and was authored by Emmanuel Tejeda
Emmanuel Tejeda | Sciencx (2022-06-28T11:25:25+00:00) What is Java? The JDK, JRE, and JVM.. Retrieved from https://www.scien.cx/2022/06/28/what-is-java-the-jdk-jre-and-jvm/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.