What is Java and what do you need to get started

Learn what Java is, the features of the Java language, download the JDK, create your work environment to program with Java using the Eclipse IDE.

This is an introduction to Java for people who want to take the first steps with the language, that is, learn about its features, download and configure the programs we need to work with Java.

In summary, here you will be able to know what Java is and what you need to start, an article made based on the content that José Luján offered us in an open training session held at .com and that serves as a prelude to what we are going to teach at EscuelaIT .

Java is one of the most difficult languages ​​to learn, perhaps not so much because of its syntax or the fact that it is object-oriented, but more because of its breadth. Within Java you have a library of classes (libraries) to do any kind of thing. It is very difficult to develop any type of application and start from scratch in Java, on the contrary, you will always rely on something already written, which implements the bases of what you want to build.

Java is very big and that, although it represents a difficulty in learning, is also one of its advantages. In fact, it could be said that, even if a developer has many years of programming experience, it is practically impossible for him to know all the areas for which Java can be used, there are already many and very different ones. Normally, the classes (libraries) that you are going to use when you make one type of program are different from the ones that you will use for another and the usual thing is that the projects only require working with a small set of the resources that exist in Java.

A bit of Java History

Java is a language that appears in 1995. To get an idea, it has more or less the same lifetime as other popular languages ​​like Python or PHP, but nevertheless Java is totally revolutionary. We can say that the reason for being so popular and innovative is that it has a unique philosophy: “write once, run everywhere”. In other words, you program it once and run it on any system.

That philosophy is what made Java a myth, but Java also has some characteristics that make it very useful: it is one of the strongest languages, with the largest number of libraries to do anything and with one of the largest communities. In addition, Java is one of the highest paid languages ​​today.

Java was developed by Sun Microsystems, but it is James Arthur Gosling who is considered the father of the language. Java is currently owned by Oracle, which bought Sun and is responsible for its commercialization and the continuity of language development.

See also  Webpack Handbook

Java has recently seen a new flourish as Google used the language as a foundation for developing the Android operating system and as a native language for developing apps for its smartphones. However, Java is traditionally used in countless environments and applications.

Java Virtual Machine (JVM)

Java is a cross-platform language, which runs on any machine. This is thanks to the JVM (Java Virtual Machine) that allows us to run Java code anywhere that virtual machine has been created for. JVM is the secret (not so secret because everyone knows it) and the key to Java as a cross-platform language.

The JVM acts as a bridge between the compiled Java code and the machine where it is intended to run. We can see it as a translator, which is responsible for interpreting the Java code, so that it is correctly executed in the target system. That is, with Java we compile the code and the result of the compilation is executed in the JVM that has the operating system where you want to launch the program.

In this article we will return later to analyze this scheme of operation. For now, you can stay with the fact that the JVM is the piece that allows the Java philosophy to be programmed in a language and the same program can be executed on Mac, Windows, Linux and even on other types of systems, as long as they have a MVP.

Almost any hardware can mount a JVM and thus be compatible with Java. In fact, the first mobile phones, before the advent of smartphones, had the ability to run games in Java and that’s because a JVM had simply been created for them.

What do you need to develop in Java?

Below we describe all the materials you must have to program in Java.

Note: Be careful, we are referring to making programs in Java at a general level in any of the branches, but we have to exclude Android, which is a complete operating system and requires other specific software to be able to program applications. At the moment we want to teach you how to program in Java at a general level, but if what you want is to program in Android we have another manual that we can recommend, also by the same author: .

1) Java JDK

The first thing you need to be able to develop in Java is the “Java Development Kit”. It is free software that contains everything your machine requires to work with the language, both the JVM and the libraries to create Java programs, from the most basic to the most complex and specific.

To get the JDK you need to download it from the Oracle page. It’s often a bit tricky to navigate these kinds of “macrosites”; we recommend you go the fast lane and google “download java jdk”. This will take you to the main JDK download page on the Oracle site.

See also  Different ways to access Image Javascript objects

There are different “deliveries”, “flavors”, or “packages”, of Java. Each one has a name and sometimes it is a bit confusing because there are so many acronyms to learn. You can see in the following image a summary of the “Java SE Platform”, which is a diagram that Oracle offers us to know what we are downloading when we download one of these Java deliveries.

As you can see, when you download the JDK, you are actually downloading the entire Java, including all the libraries and of course the Java VM (JVM). If you download the JRE, you’re actually bringing back a subset of Java. So, you simply have to look at what you are downloading to bring you what you need.

Note: In summary, if you download the JDK you finish sooner because there you have everything, although of course, the download will also be greater.

From the Oracle page you can download the JDK in the latest version published and then you will have to use the one that is for your operating system. If you are on Windows you will also have to choose the x86 version for 32bit processors and the x64 version for 64bit processors.

When you install Java, everything is already configured on your system, so you shouldn’t have any problems getting started with it.

2) JVM

Most likely, you already have the Java Virtual Machine on your system (it is common for Java to be installed on your computer because even without knowing it you are using a program developed with Java.) Whether or not you had Java is not really a concern, because as As you could see in the previous image, the MVP is also installed when you install the JDK for Java.

Note: While getting the JVM isn’t really an extra step, we’ve highlighted it here to make it clear that having it is a prerequisite for using Java.

3) IDE for development

The third step would be to have an IDE for development. IDE stands for “Integrated Development Environment” or in Spanish, Integrated Development Environment. We recommend using Eclipse, and we’ll cover more about getting and using Eclipse later.

Workflow for developing in Java

Before continuing we want to make a stop to better explain the workflow when programming in Java and that will give us a more accurate idea of ​​why Java is different from other languages ​​and also how an IDE makes it easier for Java developers.

1) When you program Java you write files with the Java code. Like any language they are plain text files. In this case, you will always save them with the “.java” extension.

2) When you compile your Java files you create what are called the “Byte Code”, which are the “.class” files. Generally, any of the IDEs used to develop with Java (we’ll name a few yet in this article) have built-in tools for compiling.

See also  Notepad always gives me the .txt file extension

Note: You could also compile manually from the command line, but that’s not usually done. This was left behind thanks to the advantages of working with an advanced development environment. Perhaps the only place where it is compiled manually is at the university, where they want us to learn without relying on other tools, so that we are more autonomous or learn to do things closer to the machine. Normally within our IDE, be it Eclipse, Netbeans, etc. you simply hit the “Run” button and the entire compilation and execution process is done.

3) When you have generated the Byte Code, you can execute it on your machine thanks to the JVM that is native to your system. Remember that you have a specific JVM for each operating system. The JVM is capable of understanding Byte Code files and running them on your system without fail and displaying the same output that the JVM of another operating system would display.

This process can be seen schematized in the following diagram.

Byte Codes are the most important Java files, which give us, together with the JVM, support for multiple platforms. When you compile with Java you don’t compile your code into a native binary for your operating system, you compile it into these Byte Codes which are an intermediate step. Actually, it is the JVM that interprets the Byte Code so that when executing them the result is capable of being seen in the same way in any operating system that you may use.

Therefore, Java is a language that is first compiled and then interpreted, unlike other languages ​​which are generally either compiled like C or interpreted like PHP. With all this we might think that Java is a bit of a heavy language, but current machines have no problems executing it and Java has also been improving and optimizing.

IDE Alternatives for Java

About IDE we have several options for Java, among the best known and used we have Eclipse, Netbeans, Jdeveloper, IntelliJ IDEA. You can use any of them perfectly, as well as any other that you find and feel comfortable with.

The Eclipse IDE is by far the most widely used (it has around 60-70% usage rate among Java developers) because it is the first to become popular, thanks to the fact that it was the first to introduce the extensions via plugins. Java is attractive also because it is open and free for any type of use.

Install Eclipse to program in Java

There are also various distributions of Eclipse and sometimes we can get a little involved when it comes to…

Loading Facebook Comments ...
Loading Disqus Comments ...