Node.js nut-ioc usage

nut-ioc npm package is a simple, lightweight and fast IoC Container Framework.

nut-ioc injects dependencies run-time so that developers don't need to require modules.

Developers can implement in their codes following OOP basics, principles, patterns and concepts and probably more than that 🙂

  • Separation of Concern(SoC)
  • Single Responsibility Principle(SRP)
  • Open Closed Principle
  • Dipendency Inversion(Injection) Principle(DIP)
  • Chain of Responsibility Pattern
  • Aspect Oriented Programming

you can reach github repository.

Installing nut-ioc with npm

npm i nut-ioc

Demo GitHub Repository

You can find different usages of nut-ioc framework in separate brances.

Branch list
Continue reading

How to install Maven

Downloading and Installing Maven

if you want to download Maven manually, download it from

But you can download Maven programmatically as the following. So, run below script in your terminal.


tar -xzvf apache-maven*bin.tar.gz

# Fix the permissions:
# chown -R root:wheel Downloads/apache-maven*

mkdir /usr/local/apache-maven

mv apache-maven* /usr/local/apache-maven

rm apache-maven*

Setting environment variables in zsh

If you are using zsh, then run the following script in your terminal.

nano ~/.zshrc

export M2_HOME=/usr/local/apache-maven/apache-maven-3.6.3
export M2=$M2_HOME/bin
export PATH=$M2:$PATH

source ~/.zshrc

Setting environment variables in bash

nano ~/.bashrc

# add these three lines at the end of file and CTRL+X and Y and click enter :)

export M2_HOME=/usr/local/apache-maven/apache-maven-3.6.3
export M2=$M2_HOME/bin
export PATH=$M2:$PATH

source ~/.bashrc

Check Maven Version

# Verify if Maven is running
mvn -version

How to install Kafka


wget ""

tar -xzf kafka_2.11-1.1.0.tgz

Starting Zookeeper and kafka

bin/ config/
bin/ config/

Create topic

bin/ --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test

List topics

bin/ --list --bootstrap-server localhost:9092


bin/ --list --zookeeper localhost:2181

Send some messages to Kafka

bin/ --broker-list localhost:9092 --topic test


bin/ --zookeeper localhost:2181 --topic test

Consume messages from Kafka

bin/ --bootstrap-server localhost:9092 --topic test --from-beginning

How to install Java

Java Specification Versions:

Here are the major releases:

  1. Java 1.0 (January 1996) – The original version.
  2. Java 1.1 (February 1997) – Introduced several significant features, including the JavaBeans API.
  3. Java 2 (J2SE 1.2) (December 1998) – Introduced the Swing application framework.
  4. J2SE 1.3 (May 2000) – Introduced the HotSpot JVM.
  5. J2SE 1.4 (February 2002) – Introduced regular expressions, image I/O API, and more.
  6. Java SE 5 (J2SE 1.5) (September 2004) – Introduced generics, metadata annotations, enumerated types, and more.
  7. Java SE 6 (December 2006) – Introduced scripting support, JVM improvements, and more.
  8. Java SE 7 (July 2011) – Introduced the try-with-resources statement, the diamond operator, and more.
  9. Java SE 8 (March 2014) – Introduced lambdas, streams, and the java.time package.
  10. Java SE 9 (September 2017) – Introduced the module system.
  11. Java SE 10 (March 2018) – Introduced local-variable type inference (var).
  12. Java SE 11 (September 2018) – Introduced String::linesisBlank, and other methods, plus the HttpClient.
  13. Java SE 12 (March 2019) – Introduced switch expressions (preview) and more.
  14. Java SE 13 (September 2019) – Introduced text blocks (preview) and more enhancements.
  15. Java SE 14 (March 2020) – Introduced pattern matching for instanceof (preview) and other improvements.
  16. Java SE 15 (September 2020) – Continued the introduction and enhancement of several features.
  17. Java SE 16 (March 2021) – Introduced sealed classes (preview) and other enhancements.
  18. Java SE 17 (September 2021) – This version is an LTS (Long Term Support) release, which means it will receive updates for a longer period than the interim releases.
  19. Java SE 18 (March 2022)
  20. Java SE 19 (September 2022)
  21. Java SE 20 (March 2023)
  22. Java SE 21 (September 2023)

Java has moved to a time-driven release model, with new versions being released every six months. Not all of these are long-term support (LTS) versions. As of Java 17, the LTS versions have been Java 8, Java 11, and Java 17.

Downloading and Installing Java from OpenJDK

if you want to download OpenJDK manually, download it from

But you can download JDK programmatically as the following. Java SE 7, 8, 9, 10, 11, 12, 13 are included below script. So, run below script in your terminal.

# Java SE 7

# Java SE 8

# Java SE 9

# Java SE 10

# Java SE 11

# Java SE 12

# Java SE 13

mkdir /usr/lib/jvm

# Extract all downloaded jdk files
tar -xvzf openjdk-7u75-b13-linux-x64-18_dec_2014.tar.gz -C /usr/lib/jvm

tar -xvzf openjdk-8u40-b25-linux-x64-10_feb_2015.tar.gz -C /usr/lib/jvm

tar -xvzf openjdk-9.0.4_linux-x64_bin.tar.gz -C /usr/lib/jvm

tar -xvzf openjdk-10.0.2_linux-x64_bin.tar.gz -C /usr/lib/jvm

tar -xvzf openjdk-11.0.2_linux-x64_bin.tar.gz -C /usr/lib/jvm

tar -xvzf openjdk-12.0.2_linux-x64_bin.tar.gz -C /usr/lib/jvm

tar -xvzf openjdk-13_linux-x64_bin.tar.gz -C /usr/lib/jvm

# Remove downloaded jdk files
rm openjdk*

# Install Java and Java Compiler to Environment
update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-se-7u75-ri/bin/java 1

update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-se-7u75-ri/bin/javac 1

update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-se-8u40-ri/bin/java 2

update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-se-8u40-ri/bin/javac 2

update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-9.0.4/bin/java 3

update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-9.0.4/bin/javac 3

update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-10.0.2/bin/java 4

update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-10.0.2/bin/javac 4

update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-11.0.2/bin/java 5

update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-11.0.2/bin/javac 5

update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-12.0.2/bin/java 6

update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-12.0.2/bin/javac 6

update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-13/bin/java 7

update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-13/bin/javac 7

# Verify Java and Java Compiler Installation
# check if java command is pointing to correct path in system
update-alternatives --display java
update-alternatives --display javac

# List all environment variables
update-alternatives --get-selections
# or
update-alternatives --get-selections | grep java
# or
update-alternatives --get-selections | grep ^java

Check Java Version

# Verify if Java is running
java -version

# Verify if Java Compiler is running
javac -version

ES6 (ECMAScript 2015) Class Usage

There are some new features in ES6(ECMAScript 2015) like the following. But, we will focus on classes.

  • JavaScript let
  • JavaScript const
  • JavaScript Arrow Functions
  • JavaScript Classes
  • Default parameter values
  • Array.find()
  • Array.findIndex()

Class Declaration Syntax

Instance properties must be defined inside of class methods.

Continue reading

Node.js Babel 7.x different usage transpiling to ES5 and Debugging

I already mentioned many details in the following link. So I don't want to duplicate everything in this post one more time.

You can reach github project from the following link.

You can reach Babel 6.x post from the following link.

Creating Babel configuration file


  "presets": [
  "plugins": [
  "env": {
    "development": {
      "presets": [
            "development": true
      "sourceMaps": true,
      "retainLines": true