We are here for you MON-FRI 9AM-5PM info@systeum.cz +420 777 607 467

We are here for you MON-FRI 9AM-5PM obchod@systeum.cz +420 777 607 467

Beginnings are often difficult, so every helping hand or good advice is useful to overcome those first uncertain steps.

That’s why we’ve prepared a tutorial for you to learn how to start a new project in the development environment and program your very first project. You’ve probably heard about “Hello world” before, maybe even from us. If you follow the step-by-step instructions below, this is exactly the app you’ll rejoice over at the end.

Are you interested in the IT field and looking for job positions and opportunities in the IT industry? Whether you are a programmer, developer, tester, analyst, or software architect, contact us and we will find an IT project tailored to your needs from our IT job offers. Take a look at the current available job positions in the IT field. We will help you find new job challenges and opportunities. We look forward to collaborating with you!

Let’s start programming in Java. Today, we will use the IntelliJ Idea IDE.

Let’s get to it

When we open the IDE, the first thing to do is to select “New Project”.

This will bring up another screen where we select “Maven”. (Editor’s note: Maven is a tool for managing, automating and controlling application builds – it allows implementation of already created functionalities and other things into your project).

For now, you can see that we don’t have any JDK (Java Development Kit) installed, so you need to select “Download JDK” from the list. The latest version is automatically selected; we recommend not to change it and use it.

When you click on “Download”, the JDK is automatically downloaded and installed. Click the “Next” button.

In the next screen, you can name the project and change its location. It’s entirely up to you, the important thing is that you get to know your way around the projects.

Then the IDE itself is displayed and “pom.xml”, the basic working unit in Maven, is opened. This XML file contains information about the project and configuration details that are used to create the project. There is no need to change anything here. Data may begin to download and you may have to wait a while.

Let’s see where everything is

If you click on the left side, where the project folders are, you can see the division into two main folders: main and test. The “main” folder always contains the Classes, the “test” folder contains the tests used to verify the functionality of the project.

To avoid name conflicts, create a “Package”. It is also used to check access, to make it easier to find and use classes, etc.

Once the package is created, we can create the first class. In short, the naming convention is described as follows: when two words are used, they are not separated by a space, but only by a capital letter (for example, “TutorialApp”).

Let’s program the first app

Everything is ready, let’s program the first app. Let’s start printing “Hello world”. It’s a basic app that lets us test that all the settings really work.

You can check out the brief entry for the “TutorialApp” class. To test the functionality of our code, we will use a quick run. Click on the green “play” icon next to the class name: a menu will appear, then click on the first option “Run ‘TutorialApp.main()’”.

Once started, a small window appears at the bottom of the development environment, showing the whole process.

As in the picture, you should see a message informing you that the code has compiled without problems. That’s exactly the message we want. Let’s get into test preparation.

Don’t forget to test the app

As a developer, you need to make sure that further code changes don’t cause any unwanted bugs. And that’s why you need tests.

Right click on the Java subfolder in the “test” folder and create the “Package” again. We recommend giving it the same name as the Package in the “main” folder. Then right click on the Package name and create a class called “TutorialAppTest”.

Once created, the test class will open again and we can start testing. This is where you’ll need to decide what testing framework to use. We are going to use jUnit, one of the most widely used testing frameworks, but you can also choose the widely used TestNG or another one of your choice.

Don’t be surprised if a lot of things turn red when you run the test, just like you can see in the picture. Don’t worry, it’s normal in the beginning, because we haven’t imported the necessary dependencies that we need for the code to work properly. 

How to fix the red parts of the code?

Click on the red text and leave the cursor on the text for a moment. The following will be shown: “Cannot resolve symbol ‘ByteArrayOutputStream’”. Now press Alt+Enter to see a menu of actions you can perform. Select the first option “Import Class” to download the class you need.

And then you will see this dependency. It allows the created class to find out that it should take the necessary information from this imported class.

Let’s look at the “@Before” annotation. Generally, annotations in jUnit are used to inform what is to be done and when. The @Before annotation tells us what happens before the test itself, the @Test annotation indicates the test itself and its progress, and the @After annotation informs us about what happens after all the tests are finished. Older versions use @Before, newer versions @BeforeAll.

Repeat the same action we did a moment ago. Click on the red text and press Alt+Enter.

Import classes and annotations for all red items. When you’re done editing, your code should look like this.

Now we are ready to run our code again: click on the play icon next to the class name.

The familiar window with information about the process is displayed again. You see, we have verified that the tests work.

That’s it! All that’s left now is to praise yourself and be happy about a job well done. The first app is programmed!

Stay tuned, we’ll be covering some larger projects with more classes, tests, and we’ll also look at how to solve basic problems that can arise during development. We wish you every success.

The instructions were prepared for you by Standa Keppert.

 

🟡 Are you looking for an interesting project? Check out how we do things here and see which colleagues we're currently looking for.

🟡 Do you have a colleague or friend who is looking for a new project? Join our Referral program and get a financial reward for your recommendation.

🟡 Would you like to start working in IT? Download our ebook START WORKING IN IT: From First Steps to Dream Job, in which we guide you step by step with information, courses, and practical experience that are so essential not only for those who want to switch fields, but also for those who want to advance their careers and further their education.

Or share this article, which may also be useful to your acquaintances.

Would you like to receive our articles regularly in your inbox? Give us your e-mail address and we will be happy to serve as carrier owls.

You may also be interested in

“Bob, write…” 2: practical instruct...

Reading time 5 minut 1.3.2022

How to develop your own mobile game...

Reading time 5 minut 29.6.2021

“Bob, write…” or who wouldn’t want ...

Reading time 4 minuty 9.2.2022

What they say about us?
 Ask our clients…

Systeum
Systeum

„Systeum is one of the biggest providers of our testing capacities. Years of cooperation have proved the outstanding quality of candidates. I also appreciate the willingness of the whole team.“

Head of test execution

„I really appreciate individual approach. Systeum provides us with teams of testers, C/C++ and Java developers. Specialists meet our requirements on knowledge of network protocols and cloud solutions“

Chief Technology Officer

„Systeum is our stable, long-term partner. Thanks to Systeum we have functional high quality senior teams of C++ embedded developers and auto testers sice 2015.“

Head of Payment Application

„Systeum, thank you for your help to find the right fit to my team! I can recommend cooperation with you to everybody. Very professional, smooth and friendly.“

IT CIM Inventory Management Development

Examples of long-term cooperation

Komerční banka Monster Generali Porsche Raiffeisen BANK Moneta