In the previous chapter, you learned about Spring Boot in a nutshell and its advantages. We also tackled the latest features of Java 17. The same goes for Angular; you had an overview of Angular and the benefits of using it to develop frontend applications.
This chapter will teach you how to set up your computer’s development environment to develop your full-stack Java and Angular application. We will tackle different IDEs and text editors to write our code and make sure everything has been configured before we start with the development.
Installing everything correctly from the beginning will help us avoid issues and write code without any interruptions.
In this chapter, we will cover the following topics:
The following are the links to the software you need to install:
This section will guide you through the installation and configuration of VS Code or IntelliJ IDEA. We will look at the text editor and IDE breakdown of their features and plugins that you can use throughout the development.
Download the VS Code installer from https://code.visualstudio.com/download. We suggest installing VS Code regardless of your machine’s OS, because VS Code is lightweight but offers many plugins for Angular development. In addition, VS Code is the most common text editor used by JavaScript developers. The editor supports TypeScript, code formatting, and code navigation and offers many extensions that you can use, especially in developing Angular applications. The following are some of the valuable extensions we can use throughout the development:
This ends VS Code installation and configuration. Your VS Code text editor is now set for Angular development.
This IDE is one of the most popular IDEs when developing applications using Java. The IDE offers several features to make development easier and faster. The following is a list of the tools that IntelliJ IDEA offers:
You should go to https://www.jetbrains.com/idea/download/ to download the installer. In addition, you can download the community version, which is the free version of Visual Studio.
After successfully downloading the IDE, run the installer, and the process is very much straightforward. It will install the IDE automatically in our terminal. After the successful installation of IntelliJ IDEA, we will install plugins/extensions that will help us throughout the development.
To install the plugins, open the IntelliJ IDEA and press Ctrl + Alt + S. This will open the settings window, then you should go to the Plugins menu to access the marketplace:
Figure 2.1 – Marketplace for IntelliJ IDEA plugins
It will list all of the available plugins we can add for our development. We will install the following plugins:
This ends the installation and configuration of IntelliJ IDEA. Your IDE in your machine is all set.
This section will explain what Java 17 is and guide you through the installation of the kit on Windows, macOS, and Linux.
Java 17 is a Java Development Kit (JDK) required for building applications and components using the Java programming language. It is the latest long-term support (LTS) release, meaning that the vendor (Oracle) will support the version for a long time, including the patching of security issues.
Execute the following steps to install Java 17 on Windows:
Figure 2.2 – Java 17 installer
After successful download, open the installer and it will prompt you with a step-by-step installation that you can follow.
Figure 2.3 – Java 17 installation setup
Figure 2.4 – Java 17 installation destination folder
"C:Program FilesCommon FilesOracleJavajavapathjava.exe"
"C:Program FilesCommon FilesOracleJavajavapathjavaw.exe"
"C:Program FilesCommon FilesOracleJavajavapathjavac.exe"
"C:Program FilesCommon FilesOracleJavajavapathjshell.exe"
We have now successfully installed Java 17 on our Windows machine. Now, we will show you the steps for installing Java 17 on macOS.
There are things to consider when choosing the installer for Java 17 in macOS. First, we need to know that the installation for JDK 17 contains version notation that represents the Feature, Interim, and Update versions. For example, if you are installing interim 1, update 1, and patch 1, the installer name would be as follows:
jdk-17.1.1.1_macos-x64_bin.dmg
jdk-17.1.1.1_macos-x64_bin.tar.gz
jdk-17. 1.1.1_macos-aarch64_bin.dmg
jdk-17. 1.1.1_macos-aarch64_bin.tar.gz
Execute the following steps to install Java 17 on macOS:
We have now successfully installed Java 17 on macOS. Now, we will show you the steps for installing Java 17 on Linux platforms.
When installing Java 17 on a Linux system, we also need to be aware of the version notation, as when choosing the installer for macOS. The version format represents the Feature, Interim, and Update versions. So, for example, if we are downloading the interim 1, update 1, and patch 2, then the installer name would be the following:
You can install the JDK on a Linux platform using the archive files or Red Hat Package Manager (RPM):
To install the JDK for 64-bit Linux platforms, the tar.gz archive file, also known as a tarball, can be downloaded from the following URL: https://www.oracle.com/java/technologies/downloads/#jdk17-linux.
The files that we see are as follows:
After successfully downloading the tarball file, accept the license agreement and place the .tar.gz file in the directory where you want to install the JDK.
Unpack the file and install the downloaded JDK as follows:
tar zxvf jdk-17.interim.update.patch_linux-x64_bin.tar.gz
Or with the following code:
tar zxvf jdk-17.interim.update.patch_linux-aarch64_bin.tar.gz
After successfully installing the JDK, we can see that it is now installed in a directory called jdk-17.interim.patch.update.
We can install the JDK using RPM binary files for RPM-based Linux platforms, such as Oracle and Red Hat. Before installing the JDK, we must first make sure that we have root access. You can have root access by running the su command and entering the super password.
The RPM file can be downloaded from https://www.oracle.com/java/technologies/downloads/#jdk17-linux, and we get the following files:
Install the package using the following command:
rpm -ivh jdk-17.interim.update.patch_linux-x64_bin.rpm
Or use the following command:
rpm -ivh jdk-17.interim.update.patch_linux-aarch64_bin.rpm
After executing the command, the JDK is now successfully installed on our machine. Then, for future version upgrades, we can execute the following command:
rpm -Uvh jdk-17.interim.update.patch_linux-x64_bin.rpm
rpm -Uvh jdk-17.interim.update.patch_linux-aarch64_bin.rpm
We are done installing and configuring the JDK 17 on our machine on different operating systems. In the next section, we will install SDKMAN.
This section will explain what the purpose of SDKMAN is in developing Java applications. This section will also guide you through the installation of SDKMAN on Windows, macOS, and Linux.
SDKMAN (Software Development Kit Manager) is a tool for managing parallel versions of Java on our machine. We can have multiple versions of installed Java versions on our computer. You can also install Java directly using SDKMAN. It will automatically install the latest stable version or the version you specify.
SDKMAN is mainly created for Unix operating systems, but it also supports Bash and ZSH shells for other operating systems.
The following are the features of SDKMAN:
To see all the SDKs that SDKMAN supports, we can execute the following command:
sdk list
The command will list all the SDKs and the Java library managers we can download on our machine.
To install a specific SDK, for example, we want to install the latest SDK for Java, execute the following command:
sdk install java
If we want to install a specific version of the SDK, we will specify the version in the command as follows:
sdk install java 15-open
To switch between versions when multiple versions are installed on our computer, we will execute the following command:
sdk default java 15-open
It only takes a few commands to install SDKMAN on macOS and Linux. For us to install SDKMAN, we will execute the following command:
curl -s https://get.sdkman.io | bash
After following all the instructions on installing SDKMAN, open a new terminal and execute the following command:
source "$HOME/.sdkman/bin/sdkman-init.sh"
The command will successfully install the manager in your terminal. To check whether the installation is successful, we can execute the following command:
sdk version
This will display the current SDKMAN version installed on your machine.
We need several steps to install SDKMAN on Windows since SDKMAN requires Bash tools. In this case, the first thing we need is a Git Bash Environment (MinGW):
ln -s /c/Program Files/7-Zip/7z.exe /c/Program Files/Git/mingw64/bin/zip.exe
Now we can use the commands we use in Linux to install the SDKMAN.
export SDKMAN_DIR="/c/sdkman" && curl -s "https://get.sdkman.io" | bash
sdk version
It will prompt the current version of SDKMAN installed in our terminal.
We are done installing and configuring SDKMAN on our machine on different operating systems. In the next section, we will configure IntelliJ IDEA with the installed Java 17.
We have installed our IDE (IntelliJ IDEA) and Java 17 on our machine in the previous sections. Now, we will guide you on how to configure Java 17 on new and existing projects.
We only need the following few steps to use Java 17 on our new Java project:
Figure 2.5 – Creating a new project in IntelliJ IDEA
We will see the preceding modal and select the type of project we need to develop. We can also see that we can choose the SDK version we need for our project.
We have now successfully configured our new project with JDK 17. Now we want to configure existing projects with JDK 17.
Upon upgrading our project from an older version to Java 17, we need to follow several steps for our applications to work. First, remember that this upgrading to Java 17 step is only the general configuration in upgrading. It depends on the current version of the project. Also, some code and dependencies are being used on your project that are already deprecated.
We only need a few steps to use Java 17 on our existing Java project:
Figure 2.6 – IntelliJ IDEA project settings
We are now done configuring our project with Java 17. In the next section, we will install helpful tools for our development in Java and Angular, such as REST Client and Angular DevTools.
In this section, we will guide you through the installation of REST Client and Angular DevTools. REST Client is an essential tool in RESTful APIs. It is a tool for sending HTTP requests to the API you develop to debug the flow of your code on the endpoint as well as its response. There are several third-party platforms for API testing, such as Postman, but REST Client can be directly installed in your IDE.
Angular DevTools, on the other hand, is a Chrome extension for Angular that provides debugging and profiling capabilities for Angular applications. The extension supports Angular version 9 and later, and it is also Ivy enabled.
We only need to follow these steps to install REST Client in VS Code:
Figure 2.7 – REST Client installation
After installation, we can use the extension by creating HTTP files in our project and writing the endpoints with the HTTP requests. The following is an example format of using REST Client:
GET https://test.com/users/1 HTTP/1.1 ### GET https://test.com /blogs/1 HTTP/1.1 ### POST https://test.com/rate HTTP/1.1 content-type: application/json { "name": "sample", "rate": 5: }
We have now successfully installed REST Client in our VS Code and can test RESTful APIs. Now, we will show you how to install Angular DevTools, which will be important for debugging Angular applications.
Angular DevTools is a Chrome extension. To install the extension, you can directly install it from https://chrome.google.com/webstore/detail/angular-devtools/ienfalfjdbdpebioblfackkekamfmbnh and follow these steps:
Figure 2.8 – Angular DevTools installation
Angular DevTools will have two tabs: the Components tab, which will display your application structure, and the Profiler tab, which is used to identify application performance and bottlenecks.
We have successfully installed Angular DevTools. Last but not least, we will install Git version control, which will be useful for code versioning and team collaboration.
Installing Git, a distributed version control system, will be the last thing we need in development. Git is important for developers as it is used to save your project’s different versions and stages of your repository. Git also helps you revert your repository’s recent working version if you made changes in your code that broke your app and you can’t fix them anymore.
Go to http://git-scm.com/ and click the Download button on the screen to download and install Git.
Now you have learned from this final section about Git version control, where to get it, what it does, and why it is crucial. Let’s summarize everything.
With this, we have reached the end of this chapter. Let’s have a recap of the valuable things you have learned. You have learned how to install VS Code, its features, and the essential extensions we can use in Angular development.
You have also learned how to install IntelliJ IDEA, its features, and the plugins that we will use in Java development. You have also learned how to install Java 17 and configure it with new and existing projects in IntelliJ IDEA.
SDKMAN is a development kit manager and it gives us the capability to switch JDK versions and install Java development packages directly. REST Client is a tool for testing RESTful APIs without downloading any third-party tools on our machine.
Angular DevTools is a Chrome extension for Angular that provides debugging and profiling capabilities for Angular applications. And last but not least, Git version control is a tool for creating histories of your code where you can quickly revert or create a new version of your application.
In the next chapter, we will be focusing on Spring Boot and its features.
18.118.171.20