Let’s execute our first java program!
Okay, I know many may not believe this but, we need to accept the truth that we are into our 3rd year of engineering now. (Smile in pain!)
Well, OOPS is new course for all of us, where we implement things in .java
Now, let’s see how to install JAVA on our systems.
Step 1 — Install JAVA
Installation of JDK. From this link, download the JDK file ~150 MB and install it.
Productivity tip: x64 file is for 64 bit windows and x86 is for 32 bit version of windows. Make sure you download the correct package.
Step 2 — Setting up environment variables
Search for “Environment Variables” from start menu.
Find the path of JAVA on your system, most often that will be in below address
Setting up PATH: Now edit path variable(if exists) or create a new variable and name it as PATH and add the below directory to it.
Setting up JAVA_HOME: Create a new variable and name it JAVA_HOME and add the below value to it.
Step 3 — Write the code
Open any of your favorite text editor with and write the below lines into it and save it as: FirstJavaProgram.java
Note: public class defined in line 1 must be same as file name you save.
Step 4 — Execute!
Open command prompt in the folder where java file is located and execute below two commands:
// This command compiles the code
// This command executes the code
Step 5 — Experiment!
And it’s in your hands how you do it. xD
How to Download & Install Java JDK 8 in Windows
In this tutorial learn how to download and install Java JDK 8 in Windows and set environment variables.
How to Compile and Run your First Java Program
In this tutorial, we will see how to write, compile and run a java program. I will also cover java syntax, code…