How do I install Gradle in Mac OS X?


In this post we will learn how to install Gradle in OS X. The following steps will guide our installation process to make Gradle available in our OS X machine. But before we start let’s take a look at the definition from wikipedia about Gradle.

Gradle is an open source build automation system that builds upon the concepts of Apache Ant and Apache Maven and introduces a Groovy-based domain-specific language (DSL) instead of the XML form used by Apache Maven of declaring the project configuration.

From: Wikipedia

I. Using Homebrew

The short and simple answer is to use the Homebrew package manager for macOS. You can visit the website for detail on how to install the Homebrew. But to help you, I’ve copied the online script to install it below:

/usr/bin/ruby -e "$(curl -fsSL"

After installing Homebrew, just type the following command to install Gradle.

brew install gradle

Now, if you want to do it manually, here are the steps 😉

II. Manual Installation Steps

1. Download Gradle

To download visit Gradle Releases Page. Download the complete distribution which includes binaries, sources and offline documentation. For example you can download the latest release of Gradle, as of this update the version is

2. Upacking Gradle and Configure Environment Variables

  • Open
  • Create a new directory sudo mkdir /usr/local/gradle.
  • Extract the downloaded Gradle distribution archive by executing sudo unzip -d /usr/local/gradle.
  • Edit .bash_profile in your home directory to add GRADLE_HOME variable with the following line export GRADLE_HOME=/usr/local/gradle/gradle-4.0.2
  • Also update the PATH variable to include $GRADLE_HOME/bin. If you don’t already have the PATH variable add the following line export PATH=$GRADLE_HOME/bin:$PATH
  • Run source ~/.bash_profile to executes the update version of .bash_profile. Or you can open a new to make this changes active.

3. Running the Installation

To test Gradle installation open the and execute gradle -v command. If your installation was correct you will see something like the following output:

$ gradle -v

Gradle 4.0.2

Build time:   2017-07-26 15:04:56 UTC
Revision:     108c593aa7b43852f39045337ee84ee1d87c87fd

Groovy:       2.4.11
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_121 (Oracle Corporation 25.121-b13)
OS:           Mac OS X 10.12.6 x86_64

Installing and Running MongoDB in Windows 7

What is MongoDB

In this post you will see how to install and running MongoDB database server on Windows 7. What is MongoDB? MongoDB is a NoSQL database. MongoDB is a non-relational JSON document store, a document oriented database. Non-relational means that it doesn’t support the relational algebra that most often expressed in SQL like what RDBMS such as Oracle or MySQL does. The document here is not a Microsoft Word documents or such, but it is a JSON (JavaScript Object Notation) documents.

And if you don’t know what it is look like, here are some examples of JSON documents:

{"firstName" : "John", "lastName" : "Doe", "cityOfBirth" : "New York"}
{"firstName" : "Julia", "lastName" : "Roberts", "movieTitles" : ["Pretty Woman", "Nothing Hill", "Runaway Bride"]}

Other characteristics of MongoDB are: it has a dynamic schema, it doesn’t support SQL language, it doesn’t support Joins, and it doesn’t support transactional across multiple collections.


MongoDB Installation

After you know a bit of MongoDB lets get started with the installation process. Here are the step by step of the MongoDB installation.

  • Downloads Windows 64-bit MongoDB installer at // When this post is written the binary file name for Windows 64-bit is mongodb-win32-x86_64-2008plus-2.6.3-signed.msi.
  • After you have finish the download the installer double click the file to start the installation wizard.

    Welcome to MongoDB Setup

    Welcome to MongoDB Setup

  • Press the Next button for the next screen and check I accept the terms in the License Agreement check box and press the Next button to continue.

    End-User License Agreement

    End-User License Agreement

  • The next step is to choose the setup type. There are three types of setup available, Typical, Custom and Complete. For now we will choose Complete. So click the Complete button to continued the installation process.

    Choose Setup Type

    Choose Setup Type

  • Press the Install button to begin installation process.

    Ready To Install MongoDB

    Ready To Install MongoDB

  • After pressing the Install button you can see the screen of MongoDB installation process. Wait until the installation is done.

    Installing MongoDB

    Installing MongoDB

  • And finally you have the MongoDB database installed. Click the Finish button to end the installation process.

    Completed MongoDB Installation

    Completed MongoDB Installation

The steps above have finalize your MongoDB installation. If you check in your C:\Program Files directory you will see the MongoDB installation directory in there. There will be a bin directory under C:\Program Files\MongoDB 2.6 Standard where all the MongoDB application files. Now you have install the database server lets run and check the database server.


Running MongoDB

For this step we will focus on two files from the bin directory of the MongoDB installation. The mongod.exe and mongo.exe. The first executable is the MongoDB database engine daemon while the second executable is the shell program to access the MongoDB.

To run the database do the following steps:

  • Create data directory. By default MongoDB look for \data\db directory in the root Drive from where you run the mongod. For example you can create C:\data\db. Or you can use the --dbpath argument to tell MongoDB where to store the data.
  • Open Command Prompt and cd to C:\Program Files\MongoDB 2.6 Standard\bin and type mongod to start the daemon.
    MongoDB mongod

    MongoDB mongod

    The screen above shows you that the MongoDB is successfully started, using the dbpath \data\db and it ready and listening for connections on the default port 27017.


Running The Shell

  • Open Command Prompt and cd to C:\Program Files\MongoDB 2.6 Standard\bin.
  • Run mongo.exe to start the shell. You’ll see a welcome message to the MongoDB shell.

    MongoDB mongo shell

    MongoDB mongo shell

  • In the shell above we run a couple of commands:
  • use peopledb command ask the MongoDB to change to the persons collections, if it doesn’t exist Mongo will create one.
  • To add document to the collections we can call db.persons.insert(); and passing the JSON document as the arguments.
  • To query the collection we can use db.persons.find().
  • If you want for instance to find Julia in the collection you can do db.persons.find({"firstName" : "Julia"})
  • To close the shell we can call quit() command.

That’s all for now, I hope this post is useful for you. In the next post I will show you how to create a simple Java application that use Mongo Java Driver to store data using Java programming into the MongoDB database. So, see you in the next post. Thank you.

Java SE Installation Tutorial

Summary: This tutorial is about Java Development Kit (JDK) Standard Edition installation guide. After reading and executing this tutorial you will be able to install the JDK and setting the basic configuration for running the Java compiler from the command line. You will also learn how to create, compile and run a simple Hello World program written in Java.

Download The JDK

When this tutorial is written, the latest JDK is version 7 Update 45. To download the Java SE Development Kit 7 (JDK 7) click to following URL: Java SE Downloads. Make sure you choose the Windows version and download the JDK and not the JRE. The JDK installer will have the JRE included.

Installing The JDK

After downloading you will have a file called jdk-7u45-windows-i586.exe. Executing this file, either by double click the file or running it from the command prompt, will begin the installation process. You will see the following screens during the installation process:

Installation Wizard Welcome Screen

Installation Wizard Welcome Screen

To continue the installation click the Next button shown in the screen above. This action will bring you to the features selection screen in the installation wizard shown below.

Features Selection

Features Selection

In the features selection screen above you will be able to choose which features to install. For the simplicity of this tutorial we will choose to install the entire features. We will also use the default installation path. In Windows operating system the default path is C:\Program Files (x86)\Java\jdk1.7.0_45. Click the Next button to continue to the next step.

Installation Progress

Installation Progress

The screen above shows the progress status of the JDK installation. Depending on your computer speed this process may takes a couple of minutes to finish. Wait for the next screen to show up.

JRE Installation Screen

JRE Installation Screen

As stated above that the JRE is included within the JDK installer, the screen above show you the JRE installtaion wizard. We will use the default path as shown above C:\Program Files (x86)\Java\jre7. Click the Next button to continue to the next step.

JRE Installation Progress

JRE Installation Progress

The screen above shows the status of the JRE installation. Depending on your computer speed this process may takes some other minutes to complete. When the JRE installation complete you will see the next screen.

JDK Installation Completed

JDK Installation Completed

Seeing the screen above means that your JDK installation is completed. Click the Finish button to exit the installation Wizard.

Configuring The JDK

Now you have the JDK installed on your system. Configuring the JDK so that you can run the javac and java commands from the command prompt is another important steps. A lot of beginners faced with a problem that the javac command is not recognized because they didn’t configure the path correctly.
To validate your installation type the javac command in the command prompt. At first you will see the following screen as the command output.

javac command is not recognized

javac command is not recognized

To make the javac command run properly you need to update the PATH environment variable to include the Java binary installation path. The following steps will show you how to configure the PATH environment variable.

  • Open your Windows Explorer, you can use the Windows + E shortcut.
  • Right click on Computer icon and choose the Properties menu.
  • Click Advanced system setting from the Task list.
  • In the System Properties window choose the Advanced tab.
  • Click the Environment Variables button.
  • In the Environment Variables windows you will see two sections. User variables and System variables.
  • Find the Path variable and click the Edit button.
  • In the Edit User Variable screen, update the current variable value by adding the path  to JDK bin folder, in our case the path will be C:\Program Files (x86)\Java\jdk1.7.0_45\bin;. You should add this information at the beginning at the beginning to make sure it will be picked first.
  • Press the OK button to update the User Variable.
  • Press the OK button to finish the Environment Variables setting.
  • Press the OK button on the System Properties window to close it.

Now you can open a new command prompt window and type the javac command. You will see that the javac command is now run as expected. You can type javac -version to check the version of your JDK.

Java Command Recognized

Java Command Recognized

Creating The

Now you have the JDK installed and configured properly. Let’s now create our first Java program, the famous Hello World program. Let’s begin.

  • Open a command prompt window.
  • Create a directory C:\HelloWorld\src.
  • Go to the src directory and create another directory call program.
  • Go to the program directory.
  • Create the source file by typing notepad.exe
  • The Notepad program will show a dialog saying that the file is not found.
  • Press the Yes button for creating the file.
  • Type the following code in the Notepad editor.
package program;

public class HelloWorld {
   public static void main(String[] args) {
       System.out.println("Hello World");
  • Click the Save menu to save your program.
  • Click the Exit menu to exit from the Notepad program.
  • Type the dir command and you will see that you have created a file called

Compiling Java Source File

Up to this step you have created your first Java program. Before running the program you need to compile it. The compilation process compiles your Java source file into something called the Java bytecode. The bytecode is an intermediate language that makes the Java program portable across different platform.

To compile the program do the following step:

  • Go to the C:\HelloWorld\src\program directory.
  • Type javac to compile the source code.
  • A successful compilation will produce a HelloWorld.class file. This class file is your binary HelloWorld program and it is ready to be executed.
Compiling Hello World

Compiling Hello World

Running the Program

Now you are in the final step of the tutorial. Running the HelloWorld program. Here are the final step you need to run:

  • Go to the C:\HelloWorld\src directory.
  • Type java program.HelloWorld without the .class extension to run the program.
  • You will see that the Hello World string printed on the screen.
Running Hello World

Running Hello World

That’s all for now, see you on another tutorial.