Lesson1 Getting Started

Image for post
Image for post

This is the introduction of a series of articles to help others learn how to program in Java.

Introduction

Java is a general purpose programming language. It is more specifically a object oriented programming (OOP) language. OOP is basically a model organized around objects.

Image for post
Image for post

Java was developed by James Gosling at Sun Microsystems in 1995 and is currently owned by Oracle as of this writing, year 2018. It was created with the idea to write code one time and be able to run it on any operating system, hence the term “Write Once, Run Anywhere”.

How to get set up to start programming in Java ?

To get started programming in Java, you will need some “tools” to get started on your project, like a handy man. One tool that you will need is pretty obvious a computer, another tool is the Java programming language (JDK), and a program called an Integrated Development Environment (IDE). Their are many FREE IDE’s for you to choose from for Java. There is Eclipse, Netbeans , JCreator, and Android Studio just to name a few. In this article we will install the Eclipse IDE.

Helpful Definitions:

JDK

Java Development Kit is the core component of Java Environment and provides all the tools, executables and binaries required to compile, debug and execute a Java Program. JDK is a platform specific software and thats why we have separate installers for Windows, Mac and Unix systems. We can say that JDK is superset of JRE since it contains JRE with Java compiler, debugger and core classes. Current version of JDK is 1.7 also known as Java 7.-[1]

JVM

JVM is the heart of java programming language. It stands for Java Virtual Machine When we run a program, JVM is responsible to converting Byte code to the machine specific code. JVM is also platform dependent and provides core java functions like memory management, garbage collection, security etc. JVM is customizable and we can use java options to customize it, for example allocating minimum and maximum memory to JVM. JVM is called virtual because it provides a interface that does not depend on the underlying operating system and machine hardware. This independence from hardware and operating system is what makes java program write-once run-anywhere.-[1]

JRE

JRE is the implementation of JVM, it provides platform to execute java programs. It stands for Java Runtime Environment. JRE consists of JVM and java binaries and other classes to execute any program successfully. JRE doesn’t contain any development tools like java compiler, debugger etc. If you want to execute any java program, you should have JRE installed but we don’t need JDK for running any java program.-[1]

Install JDK

As of this writing we will use Java SE Development Kit 8.

  1. Go to: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

2. Click Accept License Agreement

Image for post
Image for post

3. Choose your system
I am using Windows 64 bit system, so I will choose Windows x64 (jdk-8u161-windows-x64.exe).

4. Run the executable file and follow the steps.

Install the Eclipse IDE:
As of this writing the newest eclipse version is Eclipse 4.7 (Oxygen), which was release on June 28, 2017.

5 Steps to Install Eclipse:

1. Download the Eclipse Installer

Download Eclipse Installer from http://www.eclipse.org/downloads

Eclipse is hosted on many mirrors around the world. Please select the one closest to you and start to download the Installer

2. Start the Eclipse Installer executable

For Windows users, after the Eclipse Installer executable has finished downloading it should be available in your download directory. Start the Eclipse Installer executable. You may get a security warning to run this file. If the Eclipse Foundation is the Publisher, you are good to select Run.

For Mac and Linux users, you will still need to unzip the download to create the Installer. Start the Installer once it is available.

Image for post
Image for post

3. Select the package to install

The new Eclipse Installer shows the packages available to Eclipse users. You can search for the package you want to install or scroll through the list.

Select and click on the package you want to install.

Image for post
Image for post

4. Select your installation folder

Specify the folder where you want Eclipse to be installed. The default folder will be in your User directory.

Select the “Install” button to begin the installation.

Image for post
Image for post

5. Launch Eclipse

Once the installation is complete you can now launch Eclipse. The Eclipse Installer has done it’s work. Happy coding.

Image for post
Image for post
Image for post
Image for post
http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/oxygen2

Let’s Write Your First Java Program !

We will write a simple “Hello, World” program. First open up Eclipse. Click File → New →Java Project. Name it “Lesson1”. Right Click on the src folder, and choose “new class”, and call it HelloWorld. So now we have our HelloWorld class, copy and paste the following code on the HelloWorld class:

public static void main(String[] args) {
// Prints "Hello, World" in the terminal window.
System.out.println("Hello, World");
}

So now your HelloWorld file should look like below:

public class HelloWorld {
public static void main(String[] args) {
// Prints "Hello, World" in the terminal window.
System.out.println("Hello, World");
}
}

Now Click the green button at the top to run your program ! Notice down below in the console it printed “Hello, World” !

You can also watch the video below to see a visual example.

If you would like some reading material on the Java programming language, I suggest the book called Head First Java, 2nd Edition to get started with this programming language. The book goes over topics like Polymorphism, data structures, objects, and Java libraries.

Image for post
Image for post
Head First Java, 2nd Edition

Thanks for reading this article I hope its helpful to you all ! Keep up the learning, and if you would like more computer science, programming and algorithm analysis videos please visit and subscribe to my YouTube channels (randerson112358 & compsci112358 )

Check Out the following for content / videos on Computer Science, Algorithm Analysis, Programming and Logic:

YouTube Channel:
randerson112358: https://www.youtube.com/channel/UCaV_0qp2NZd319K4_K8Z5SQ

compsci112358:
https://www.youtube.com/channel/UCbmb5IoBtHZTpYZCDBOC1CA

Website:
http://everythingcomputerscience.com/

Video Tutorials on Recurrence Relation:
https://www.udemy.com/recurrence-relation-made-easy/

Video Tutorial on Algorithm Analysis:
https://www.udemy.com/algorithm-analysis/

Twitter:
https://twitter.com/CsEverything

YouTube Channel:

Image for post
Image for post

Computer Science Website:

Image for post
Image for post

Udemy Videos on Recurrence Relation:

Image for post
Image for post

Resources:

[1] https://www.journaldev.com/546/difference-jdk-vs-jre-vs-jvm

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store