Java Quickstart – Live Learning Notes

Hey! It’s time for getting me started with Java. I had Java in one of my undergraduate semester, but now, I need to revise it. So, without further delay, let’s dive into it.

Best way is to start with official java docs for introduction and quickstart. #1

Java file has extension .java which are then compiled with a java compiler to produce .class files which are nothing but the byte code (machine independent). Now this byte code goes to a Java Virtual Machine (machine dependent) for execution.

Some other useful terms:

Java SE development Kit (JDK) == JRE + Dev Tools
JRE == JVM + Libraries

Currently, I don’t have any IDE or Java installed on my system.

Let’s install an IDE first. I chose “ItelliJ Community Edition” #3

  1. Open ItelliJ (I am using Community Edition 2020.3.1)
  2. Started a new Java Project
  3. The IDE is asking for a JDK version to select. That I don’t have yet. So I am selecting “Project SDK” -> (dropdown menu) Download SDK -> Chose Java 11 version -> specified resource as “corretto-11 Amazon Corretto Version 11.0.0)

I am quite confused about why java has so many resources to download on oracle and others from that OpenJDK. What’s the difference and licensing, etc?

4. Click next to start the project now. (I named the project as “first-java”)
5. Click next again as I don’t want to start my project from a template.

Done. The project is started. The whole idea behind starting the project within an IDE is to separate the environment of one Java project with another. Pretty much like we create python virtual environment for python.

Currently the project directory looks like this.

I created a directory (called package inside “src”) with name “firstjava” and created a file in it “”. Now added the following code to it.

package firstjava;  

public class FirstJava {
    public static void main(String[] args) {
        System.out.println("My First App");        

Now to compile you need to go to menu bar “build” -> “build package” or simply Command+9 on Mac.

Now I can notice an output directory in my project root.

Now just run the app. Go to menu bar and “run” -> “run”. Now I can see the “My First App” printed on the terminal (inside my IDE).

In case you want to build and run using command line. Just do the following once you have JDK installed on your machine.

  1. Create a file anywhere.
  2. Add the following code in it.
public class Hello {
    public static void main(String[] args) {

3. Note that name of file and main class should match for reducing overheads later.
4. Compile it with command line “java /path/to/file/”
5. Now you can notice “Hello.class” file in the current directory.
6. Run the byte code with java -cp . Hello

Hurray! It is working. Here the -cp stands for “<class search path of directories and zip/jar files>”.

To dive in depth to learn Java, we can further refer #1 it has everything you need to know to learning core concepts of java.

Let’s now talk about the confusion of Java downloading resources on Oracle and OpenJDK.

  1. What Is the Difference Between OpenJDK and Oracle JDK? The biggest differencebetween OpenJDK and Oracle JDK is licensing. OpenJDK is completely open source Java with a GNU General Public License. Oracle JDK requires a commercial license under Oracle Binary Code License Agreement. Refer: #4
  2. And refer this

I got the point of differences between OracleJDK and OpenJDK. But what about the difference between different providers available for OpenJDK.

  1. Great article #6

Now I got it that different providers have their own modified JDKs for optimised working on the provider’s targeted systems and environments.

Here, I am ending my getting started with Java. Refer #1 to learn more of Java. 🙂

Thanks you! Have a nice day!

One thought on “Java Quickstart – Live Learning Notes

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s