Hello World
In this tutorial, we will learn how to start Java with Eclipse and will write a
simple java code to print "Hello World" .
To watch this in YouTube , please visit :
https://www.youtube.com/watch?v=FOiy-GGeEqU&t=46s
To begin with java, you need to install latest version of JDK(Java Development Kit) and the editor: Eclipse IDE(Integrated Development Environment). You need JDK and JRE(Java RunTime Environment), but installing JDK will automatically install JRE too. So you do not need to separately install JRE.
After installing the JDK, check your folder "C:\Program Files\Java", you will see a folder for jdk. Open the jdk folder and copy the path such as: "C:\Program Files\Java\jdk-14.0.1"
Again , click the bin folder inside jdk folder and copy the path such as: “C:\Program Files\Java\jdk-14.0.1\bin”
Now to set up environment variable, open the environment variable:
Open Control Panel then click System and Security then click System
click the link : Advanced System settings
click the tab : Environment Variables
Inside System Variables: click "Path" and click "Edit" and click "New"
Paste the path “C:\Program Files\Java\jdk-14.0.1\bin” and click "OK"
Inside System Variables: click "New" and enter
Variable Name = JAVA_HOME , remember this should be in Uppercase letter
Variable Value = "C:\Program Files\Java\jdk-14.0.1"
Click "OK" and click "OK" on System Properties window
To make sure the configuration is done properly:
Open CMD prompt(remember , you should close the cmd prompt if it was open already, and then open it again)
Type java -version and hit enter
It should show the java(jre) version , remember if it does not show the version then the configuration is not done or it is not successful or incomplete
Type javac -version and hit enter
It should show java(jdk) version
Type java and hit enter
It should show java properties
Welcome Screen |
Next step is to create a package. For this,
Next step is to create a class. For this,
At this point , you will see an EDIT Window . You have created a java project, a package, a class and now you are ready to write code on the EDIT Window.
EDIT Window |
Full code and output |
No comments:
Post a Comment