Hello friends, this is my very first post, and in this blog I will be start posting about Java. So the first post is about Java Environment Setup Windows. If you don’t know how to make your system ready for Java development then you can go through this guide. So lets learn about Java Environment Setup in Windows.
Java Development Kit (JDK) Download
So the first thing we need is JDK. It is quite easy to get JDK you can download it from oracles website. Follow these steps to get JDK.
- Go to this link.
- You will see the following screen.
- Click on Accept License Agreement.
- Then click on the required version. In my case I will download Windows x64 because I have 64bit Windows Operating System. You need to choose your version according to your system.
- Then you will get the JDK Setup file, install it in your system, the process is same as installing any other application program in windows operating system.
Java Environment Setup Windows
Once you have got the JDK installed in your system, you need to set up the environment variables to make it work. So I will teach you this now.
Follow these steps carefully to get your system ready to compile your very first Java program.
- Go to Java installation directory. (c:/program files/Java/jdk<your version>/bin);
- You need to copy the exact path according to your system. In my case the path is.
1 |
C:Program FilesJavajdk1.8.0_102bin |
- Once you have copied this file, press windows + q (for windows 8) and for windows 7 click on start menu.
- Type environment variables
- Now click on System Environment Variables.
- Now in the bottom you can see the button Environment Variables click on it.
- In the System variables section click on new.
- In variable name type path and in variable value paste the path you have copied as shown in the above image.
- Finally press ok to apply the changes and you are done.
Testing the Java Installation
- Now lets test whether the installation is successful or not.
- For this just open command prompt (window key + r, then type cmd and hit enter).
- Now write the following command.
1 |
Java -version |
- If you are getting the following result then, your installation is successful and you can move further to compiling Java program.
Writing your first Java Program
Now lets try executing our very first Java program. You need a text editor to write your codes. I am using Notepad++ you can also use the normal notepad but I will recommend you using Notepad++. You can get Notepad++ from this link.
- Open notepad++ and write the following code.
1 2 3 4 5 |
public class HelloWorld{ public static void main(String[] s){ System.out.println("Hello World!"); } } |
- Now save the file in any location of your system. I have saved it to my desktop. The name of the file should be HelloWorld.Java (public class name and file name should be same).
Compiling and Running your first Java Program
- Press shift and right click on the location where you saved the file.
- Click on Open command window here. Command prompt will open on the same directory.
- On command prompt write Javac yourfilename.Java see the screenshot for help.
- Now if you haven’t got any error executing this command, that means the code is correct and compilation is successful.
- The successful compilation will generate the .class file which contains the bytecode that will be executed by the Java Virtual Machine.
- To execute the program just type Java classname (see the screenshot).
- So its working absolutely fine, you can see we got our output.
Conclusion
So I am wrapping up this post about Java environment setup windows here. Java is the most popular programming language used nowdays. Java is used everywhere like we all use android mobile phones and to develop android applications Java is used. Java is used in web development, Java is used in desktop software development and almost everywhere you can use Java. So in the upcoming posts we will be doing some cool interesting stuffs with Java.
And leave your comments for feedback and clearing your confusions related to this Java environment setup windows tutorial. Thank You 🙂
Nice blog here! Also your site loads up fast! What web host are you using?
Can I get your affiliate link to your host? I wish my web site loaded up as fast as
yours lol
Incredible points. Sound arguments. Keep up the good spirit.
Hi there, I found your site by the use of Google while searching for a similar topic, your web site came up, it appears to be like great. I have added to faotruives|added to bookmarks.
Thanks for the article post. Cool.
Very nice article, just what I was looking for.
Nice post. I was checking constantly this blog and I’m impressed!
Very useful information particularly the last
part ? I care for such information a lot. I was seeking this certain information for a very long time.
Thank you and best of luck.
This blog was… how do you say it? Relevant!!
Finally I’ve found something which helped me. Thanks a lot!
Excellent pieces. Keep posting such kind of information on your
site. Im really impressed by your site.
Hello there, You’ve done a fantastic job. I’ll certainly digg it and
personally recommend to my friends. I am confident
they’ll be benefited from this site.
interesting ! Thanks for information !
Marvelous, what a weblog it is! This web site gives helpful data to us, keep it up.|
Great article! We are linking to this great article
on our site. Keep up the great writing.
Very nice article, just what I needed.|
thanks for sharing.good job
ساخت درب آکاردئونی پروفیل محکم