Post Image
By Daniel Tanque16 de Outubro, 2023In JavaLearning

Basics of Java Apps

The first step towards any language is to know how to install it, and run. Running requires passing by compiling, building and actually running, besides also documenting it. In this article you will learn the basics of installing java so you can do on local but also on a server, install specific versions, compiling, documenting and running, and then see how building tools (such as maven, graddle or ant) operate.

Intro to Java

Java has multiple versions, until version 8 the version pattern was 1.8, from 9 and above followed the same number same version. Sometimes it’s required version 8 because some legacy systems still operate in it, and from version 9 above a lot of new features were added.

But to install java you have to run the following command:

wget <url>

Now a few important information, first you may need to use sudo, second it may not work and you need to use the following command:

sudo curl -O <url>

Don’t forget to add the -O to save it as file format. Third is that the url is obtained in this website –

After downloading the package you need to unpack it and install, for that you run:

tar -xvf openjdk-(....)

Now one important thing to know is that Java to run, just needs the JRE, but to develop you need the JDK, and this one brings already the JRE. The JDK brings tools to Develop, Build and Run Java applications, after version 9 all is in the JDK.

How to run java?

Java is a Compiled type of language, instead of Interpreted, so it requires a compiler which compiles the code and then run it.

To compile the code you use:


To generate documentation you use:


To debug you use:


Also if you want to have java being recognized by the system you need to add to the PATH, running the following terminal:

export PATH = $PATH:/opt/jdk-(...)/bin

But when you have a big project, compiling and doing all those tasks to each .java files it’s not the proper way to do it. Thus we use Build Tools that also are used on CI/CD so you can automate compiling, testing and running.

Build Tools

The main build tools are Maven, Graddle and Ant. Those are used to compile, package, test, document and run an application, whether Java, Node, Python or other.

Ant has a Buildfile, which has targets that run specific operations. Maven has a pom.xml and Graddle has a build.gradle.

To run we do:

ant run

For maven we use:

mvn run

For graddle we use:

gradlew run

In order to have such tools you have to install and for that you run:

sudo yum install -y ant
sudo yum install -y mvn


In this approach you can now install java and use build tools to compile your project and run, and later on you will use these build tools in order to optimize automation on CICD.

svgBasics of Networking: DNS
svgBasics of Nodejs Apps

Leave a reply