classificationApache NetBeans 11

I currently reading “Hands-On Artificial Intelligence with Java for Beginners” by Nisheeth Joshi from Packt publication and this book require me to install Apache NetBeans IDE to my computer.

There is lack of installation tutorial, so that why I create this post :metal:

Firstly, let check our current java JRE and JDK installed:

$ java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

$ javac -version
bash: javac: command not found...

I dont have java compiler right now and I want to ignore current Java 8 runtime and install JDK 11 from OpenJDK, if you want to use Oracle JRE and JDK please read Using alternative utils with JRE & JDK as solution. I will be using openJDK released for Fedora repository.

$ sudo dnf install java-11-openjdk  java-11-openjdk-devel
Last metadata expiration check: 0:25:43 ago on Fri 30 Aug 2019 02:17:06 PM +08.
Dependencies resolved.
=================================================================================================================================================================================================
 Package                                                 Architecture                          Version                                              Repository                              Size
=================================================================================================================================================================================================
Installing:
 java-11-openjdk                                         x86_64                                1:11.0.4.11-0.fc30                                   updates                                227 k
 java-11-openjdk-devel                                   x86_64                                1:11.0.4.11-0.fc30                                   updates                                3.4 M
Installing dependencies:
 java-11-openjdk-headless                                x86_64                                1:11.0.4.11-0.fc30                                   updates                                 39 M
 ttmkfdir                                                x86_64                                3.0.9-56.fc30                                        fedora                                  51 k
 xorg-x11-fonts-Type1                                    noarch                                7.5-21.fc30                                          fedora                                 517 k

Transaction Summary
=================================================================================================================================================================================================
Install  5 Packages

Total download size: 43 M
Installed size: 182 M
Is this ok [y/N]: y 

After installing java-11-openjdk and java-11-openjdk-devel, my runtime still using old Java runtime. We need to activate new installed java.

$ sudo alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b10-0.fc30.x86_64/jre/bin/java)
   2           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.4.11-0.fc30.x86_64/bin/java)

Enter to keep the current selection[+], or type selection number: 2

Let have a check (again)

$ java -version
openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment 18.9 (build 11.0.4+11)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.4+11, mixed mode, sharing)

$ javac -version
javac 11.0.4

Ok now, lets download NetBeans IDE to our computer.

Check and download NetBeans IDE from here (current release are NB 11.1 and NT 11.0 LTS), Apache NetBeans is released four times a year. long-term support (LTS) release and early access release. I will installing Apache NetBeans 11.1 into my computer using binary file provided.

$ curl -c -L -O https://www-us.apache.org/dist/netbeans/netbeans/11.1/netbeans-11.1-bin.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  319M  100  319M    0     0  2453k      0  0:02:13  0:02:13 --:--:-- 3428k

After donwloading the binary, lets extract to /opt/

$ sudo unzip -d /opt/ ~/Downloads/netbeans-11.1-bin.zip

I don’t like running binary as power user (root), so let change and set current user as owner

$ sudo chown -R $USER:$USER /opt/netbeans

Make symlink for easy access from terminal

$ sudo ln -s /opt/netbeans/bin/netbeans /usr/local/bin/netbeans

We are done, now just run netbeans from your terminal and Apache NetBeans IDE will launched.

If needed, you may need to create desktop entry (menu) by creating new file on /usr/share/applications/ directory.

$ sudo vim /usr/share/applications/netbeans.desktop

Add text below and saved it.

[Desktop Entry]
Name=Apache NetBeans
Comment=Code Editing Java.
GenericName=IDE
Exec=/opt/netbeans/bin/netbeans
Icon=/opt/netbeans/nb/netbeans.icns
Type=Application
StartupNotify=true
Categories=Utility;Development;IDE;
MimeType=text/plain;inode/directory;
Keywords=Java;

Now that you have downloaded and installed Netbeans IDE, you can launch it from your Applications launcher menu or terminal. Once the application is started, you should see default welcome page :coffee: