Keywords: Compiler, IDE, JDK, JVM, Bytecode, IntelliJ, Eclipse
This article covers basic concepts such as compiler, IDE, JDK and JVM that we need to get started with programming in Java.
To program in Java, you first need to set up a programming environment that we can code in. This article covers how to set up this environment through four basic concepts that you need to know when programming in Java.
A significant advantage of Java is that it is platform-independent, which means that you can run Java on all operating systems such as Mac, Windows or Linux. Therefore, it is just as easy to program on a Mac (OS X) as on a Windows or Linux. An even bigger advantage is, it’s free! Anyone with a computer and an internet connection can thus start programming by downloading a couple of programs. But first, let’s sort out the four concepts.
To get started with Java programming, you first need to download a JDK (Java Development Kit). JDK is the development environment that enables you to develop applications and applications built in Java. The JDK contains, among other things, class libraries that facilitate programming but also includes a compiler that translates your code into machine code (more about the compiler later). Furthermore, the JDK also contains a JVM (Java Virtual Machine) that executes (runs) your program (more about JVM below).
The Java Development Kit (JDK) is available for free to download on Oracle’s website. You must download the version that is compatible with your operating system. The available versions are given under the heading Product / File Description. Download the JDK and follow the installation steps for your operating system.
A Java Development Kit (JDK) is:
When programming in Java, you also need a compiler. The compiler comes pre-installed with the JDK. The compiler translates your programming code into the computer’s internal language (machine code). A computer only understands ones and zeros, so the compiler starts by evaluating your code to see if contain any syntax errors and is written correctly. After that, the compiler translates your Java code into so-called byte files (class files). We can then run these class files in a virtual machine (JVM). This considerably simplifies, because you do not have to worry about how the computer will interpret your code. The compiler enables coding at a higher level, as we can write code that is more readable by humans, then the compiler handles the translation to the computer.
A compiler is a program that translates program code into the computer’s internal language. Hence, facilitating our work so we can write code more efficiently, without thinking that the computer should understand what we intend.
The compiler in Java:
When we are programming, we need a program to write the code in. This program is often called an IDE (Integrated Development Environment). Today, smart IDEs give us suggestions and find syntax errors for us directly when we code. Furthermore, there are several different IDEs that you can use, and it’s all about your preferences the one you end up using.
The two IDEs we recommend are IntelliJ or Eclipse. Here at code-knowledge.com, we have chosen to use IntelliJ, but both software is generally similar. However, when we show examples in future articles, we will start from IntelliJ. The version we use is the community version of IntelliJ which can be downloaded from the JetBrains website.
You can download IntelliJ from the JetBrains website and then just follow the installation instructions. Remember to select the operating system (Windows, Mac or Linux) you are using and make sure your computer fulfils the system requirements.
IntelliJ is available in two editions, the IntelliJ Community Edition is free and open-source that provides all the basic features for JVM and Android development, and the IntelliJ IDEA Ultimate that is commercial, distributed with a 30-day trial period. It provides additional tools and features for web and enterprise development.
Similarly to IntelliJ, download Eclipse from the Eclipse foundations website, select the operating system you are running, make sure your computer meets the system requirements, and follow the installation instructions.
The Integrated Development Environment (IDE):
As the name suggests, JVM (Java Virtual Machine) is a virtual machine that enables a computer to run Java programs and programs written in other languages that are also compiled to Java bytecode. Once the compiler has created the class files of your Java code, these can be read by a JVM. This makes Java so powerful because Java applications can run on any operating system, as long as the operating system has a JVM (known as the “Write once, run anywhere” principle).
JVM (Java Virtual Machine) is:
Please leave feedback and help us continue to make our site better.
How useful was this article?
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?
We now have gotten an overview of what we need to program in Java. Once you have written your Java code in an IDE, it is translated into machine code (in Java called bytecode or class files). These class files can be read by a virtual machine (JVM) that translates the bytecode so that all the various operating system can run your Java application.
On the next page, we will look at how you can get started with IntelliJ and create your first program.
To start programming in Java, you need a JDK (Java Development Kit) that contains a compiler and JVM that translates and runs the code. To make it easier when writing your code, you should also use an IDE (integrated development environment), such as Eclipse or IntelliJ.
Yes. You need a computer and internet connection, then you can download the JDK for free on Oracle’s website.
IntelliJ and Eclipse are two different IDEs, i.e. integrated development environments that can be used to write code in Java. Note that there are many different IDEs and which one you choose is about depending on your preferences.
A binary file also called a byte code, or class file is the code that the compiler creates when interpreting your java code. The computer only understands ones and zeros and to understand your java code, the computer needs to translate the code into something that the computer can understand. We call this binary files.
JVM (Java Virtual Machine) is a virtual machine that can execute bytecode.