Environment for Java programming

Simply said, I love Java! It is cross-platform, fast, powerful and widely used. Java is not easy programming language to learn but it will allow us to do some grate stuff in the future.

Simply said, I love Java! It is a cross-platform, fast, powerful and widely used. Java is not an easy programming language to learn but it will allow us to do some great stuff in the future. To get some basic knowledge of Java, I recommend you to watch Derek Banas video since it contains a lot of useful information. Beside pure Java, we are also going to use Spring Framework with Spring Boot. Here I recommend you to watch Java Brains tutorials since this was the starting point for me and it worked. In this text I will only show you my environment setup and workflow, but have in mind that if you already have a workflow that is working for you, stick to it or try this one if you wish.

Java 8 - Linux

    # Chnage _USER_ to your linux user
    export JAVA_HOME="/home/_USER_/"
    export PATH=$JAVA_HOME/bin:$PATH
    java version "1.8.0_191"
    Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
    Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

Java 8 - Windows

    java version "1.8.0_191"
    Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
    Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

Eclipse IDE for Java

Figure 1

Java - Hello World

Figure 2

Figure 3

Figure 4

Figure 5

Processing

Processing is a library for Java that will give us tools for simulation and data visualization. Of course, Processing is much more than this, it will give us a canvas for 2D or 3D animations with OpenGL acceleration. It can be used without the Eclipse and you can find awesome tutorials about it on The Coding Train Youtube channel. Now we will see how to add Processing libraries to an Eclipse project.

Figure 6

  import processing.core.PApplet;

  public class Main extends PApplet {
      public static void main(String[] args)   {
          PApplet.main("com.test.threads.Main");
      }
  }
  import processing.core.PApplet;

  public class Main extends PApplet {
      // Define main class for PApplet
      public static void main(String[] args)   {
          PApplet.main("com.test.threads.Main");
      }

      // Set window size and enable 2D acceleration
      public void settings()  {
          size(600, 400, P2D);
      }

      // Setup the environment
      public void setup() {
          settings();
          frameRate(30);
      }

      // Loop method that is drawing pixels in the window
      public void draw()  {
          background(140, 70, 260);
      }
  }

In the future I will do some projects in which we will use Processing to simulate movement of mathematical model since Processing animations are more fun and prettier then simulations from Wolfram Mathematica or Matlab. Of course, those two programs are really powerful and we are going to use them too. I created simple Snake Game using Processing to give you something interesting and motivate you to learn Java and Processing since it is a lot of fun.

Mind Snake

Share on: