Flink : Writing your first program

DevTechie
DevTechie
Published in
3 min readSep 11, 2024

--

In our last article we learned how to install flink, troubleshoot problems on the way and executing your first program from the example set.

In this article we will go into very basics and write the same wordcount program, build the jar file and execute the script. This article is for someone who is a complete beginner, intermediate to advanced programmers can skip certain parts. So, let’s get started.

What you will need?

  1. IntelliJ IDE
  2. Maven installed
  3. JAVA 11 or 8 (Java 8 is deprecated so Java 11 is preferred)

First we need an IDE, I am using IntelliJ Community version and for building our project I am using Maven.

Note: Below steps are executed on a Mac, for windows same can be done using Cygwin.

First step, in order to create a project we will use Archetype with Maven as below. Open up your terminal and navigate to the directory where you want to create your project, thereafter run below:

mvn archetype:generate                \
-DarchetypeGroupId=org.apache.flink \
-DarchetypeArtifactId=flink-quickstart-java \
-DarchetypeVersion=1.20.0

Note: Install maven if it is not installed.

--

--