Netbeans Under Ubuntu: Setting Up Your First Web Application Using Apache Netbeans

Alex Therrien
3 min readSep 27, 2019

--

I recently had to download Netbeans for one of my classes, because it has integrated Java Servlets and JSP. However, that was not easy for me, because I wanted to use it on Ubuntu. After I had downloaded Netbeans and launched the IDE, it would either crash giving me unspecific errors, or it would freeze, not allowing me to do anything.

I found some link giving me some instructions on how to download ‘Apache Netbeans’ on Ubuntu. At first, I did not want to download Apache Netbeans, because it is not Netbeans. However, I noticed that there are a lot of similarities between Apache Netbeans and Netbeans, so I decided to give it a try. I can tell you it was worth it, as I have now a working solution using this IDE.

Step 1: Download Java 8

Go in your terminal and type the following commands.

sudo apt-get update
sudo apt install openjdk-8-jdk

Then if you type:

java -version

There should be a reply indicating which version of Java you have. The version of your Java should be 8.

Step 2: Download Apache Netbeans

To download Apache Netbeans, simply type (there are two hyphens):

sudo snap install netbeans — classic

Step 3: Download Apache Tomcat

I realize that the setup for Apache Netbeans is a little more difficult than the Netbeans I am used to work with. It does not come with a server that you can use on the spot. So, you need to find yourself a server. I downloaded an Apache Tomcat server on https://tomcat.apache.org/download-80.cgi and I downloaded the tar.gz version. Once it was downloaded, I extracted the folder inside the zipped tar.gz folder, and I kept it in my Downloads folder.

Step 4: Creating your first Web Application in Apache Netbeans

Once I had my web server, I launched Apache Netbeans. I created a new project using File →New Project, and I selected Java with Maven → Web Application. Press on Next. Give a project name that suits you and you can keep the rest of the values to their default values. Press Next. On the Server settings, you will find the button Add… right next to the input field. Press on it.

A new popup will appear. Select the type of server you are going to add (Tomcat, …, by following this tutorial you would select Tomcat). Click on Next. From here, you set up the server. You will need to specify the path to the server (which is, for me, the Downloads folder, as it is where the first folder inside the unzipped tar.gz package is), and then create some credentials for your server. Choose your username and password, and do not forget your credentials as you will need them later to launch your application. By that I mean that the IDE will demand you to identify yourself whenever you will be launching your web application, so make sure you do not lose those credentials. I guess that you can add the same server as being another server and reset your credentials in that way, if it ever happens.

Figure 1.1: First pop-up appearing after you select File -> New Project with the correct selected values to create a Web Application.
Figure 1.2: Third step to fill as we are creating a new Web Application with Maven in Apache Netbeans.
Figure 1.3: Pop-up appearing after clicking the Add… button

Once you are done with creating a new server instance, this last popup will be removed and you will end with what appears on Figure 1.2. You can click on Finish and you will have a new web application.

I created this blog because searching for Apache Netbeans on Google did not yield me a lot of results, and I did not find anything relating to adding a server in Apache Netbeans. This led me to hours of confusion on how to do it. I hope this can help some of you set up your environment faster!

--

--