I installed Apache NetBeans 20 using the Linux Mint MATE software manager. Initially, I created a simple "Hello world" project for testing purposes, and it worked fine.
However, when I attempted to open a Maven project obtained from a GitLab repository, NetBeans started downloading the Maven Central Repository Index from its official source (https://repo.maven.apache.org/maven2/.i ... y-index.gz). Although the download took a reasonable amount of time, considering the size of the file (around 2 GB), it took two hours to extract its content. During this process, I noticed via htop that NetBeans was utilizing over 100% of CPU usage. Consequently, I stopped the process (never completed) and closed the IDE.
At that point, Maven and Tomcat were not installed on my system. I require both to properly run my projects. I attempted to uninstall NetBeans 20 using Flatpak and install NetBeans 21 from the .deb package downloaded from the official Apache NetBeans site. Unfortunately, the results were worse, as I couldn't even open a NetBeans project, as the IDE froze upon the attempt.
Subsequently, I reverted to the NetBeans 20 Flatpak installation and attempted to configure the "Maven Home" to my local Maven installation via the options window. However, NetBeans did not display "/etc/maven" or "/usr/share/maven" when browsing for the home directory. Also, it shows me an "/app" directory, which doesn't really exist in my filesystem. I'm unsure where NetBeans is obtaining this directory from. I think it may be a virtual one created by the IDE, or by Flatpak:
Additionally, there is no "/.m2" folder in my home directory (and I understand that it should).
I can see those mentioned folders in my filesystem in the browser:
I don't know which one should be the Maven home directory, but NetBeans doesn't recognize me any of both.
I downloaded the repository index (.gz file) via my browser, but I'm unable to set up NetBeans to work with my native Maven installation. Furthermore, it does not recognize the OpenJDK 22 I installed via apt.
Any ideas on what might be happening? I feel like there are many things I am overlooking.
Thank you very much!
Leandro
I solved this issue myself by following these steps:
Uninstalled both my Flatpak installation of Apache NetBeans 20 and my installation of NetBeans 21 from the ".deb" package.
Installed Apache NetBeans 20 from a ".deb" package downloaded from the official webpage.
In the terminal, ran the following command: "sudo update-alternatives --config java". Then, selected "/usr/lib/jvm/java-11-openjdk-amd64/bin/java" from the displayed options in the menu.
Ran the command "java --version" in the terminal to verify if the previous step worked properly. Confirming that the default Java version in my system was indeed the one I had selected.
Ran the command "whereis java" to see the directories where the desired JDK was installed.
The results in terminal looked like this:
mvn clean install -U -XEdited the file "/usr/lib/apache-netbeans/etc/netbeans.conf" using the command "sudo xed /usr/lib/apache-netbeans/etc/netbeans.conf", and added the following line:
netbeans_jdkhome=$JAVA_HOMERebooted the system, and then NetBeans ran with JDK 11 instead of JDK 21.
Launched NetBeans, went to "Tools -> Options" in the menu bar, clicked the "Java" icon, and selected the "Maven" tab.
Entered "/usr/share/maven" in the "Maven Home" field via the browser. Selected "JDK 11 (System)" in the "Default JDK" dropdown and entered "clean install -U -X" in the "Global Execution Options" field. Then, checked the platforms managed by the IDE by going to "Tools -> Java Platforms".
Those windows got like this:
Since I had Tomcat 9 installed on my system, I needed to stop and disable that service because my native installation of Tomcat was using port 8080, preventing me from accessing that port with the Tomcat version downloaded by Maven, resulting in a conflict with the one installed in my OS with APT.
I had to edit my 'pom.xml' to make my project work properly with a more recent version of JDK since the original one was written almost five years ago. So I have it like this:
Notice I've specified the Java version to 11. When trying to run it with version 21, I was getting lots of errors.
The "/app" directory, mentioned in the first post was, in fact the content of the folder: "/var/lib/flatpak/app/org.apache.netbeans/current/<large_hex_number>/files". It was actually, a virtual folder created by Flatpak, non-existent in the real filesystem.
So my conclusions are:
It's not recommended at all to install NetBeans via Flatpak or the OS Software Manager. The best option is to download the ".deb" package from the official webpage and install it. The Flatpak version runs in a "virtual" environment and doesn't recognize the packages installed directly in the OS.
The version 21 of Apache NetBeans has a few bugs, at least when running on Linux Mint 21.3. Therefore, installing Apache NetBeans 20 is the best choice since it fits very well with a standard installation of this OS.