How to install and setup Java Environment on Windows
What is Java environment?
A set of software tools required for compiling and execution of a Java application on a computer creates Java environment. Java Runtime Environment (JRE) combines with JVM and other required libraries. To run Java applications, Java Development Kit needs to be installed. JRE is part of Java Development Kit (JDK). To make your computer ready for Java environment, follow the instructions in the section below.
Setting up Java environment
- Download Java Development Kit & Java Runtime Environment from oracle.com according to your operating system.
- Install Java Development Kit (JDK)
- Java SDK has been installed successfully.
- Now, install Java Runtime Environment (JRE)
- Now setup “Environment Variables” for Java SDK.
- Open your system’s properties & navigate to “Advanced system settings”.
- Click on “Environment Variables”
- Click on “New” button
- Add “JAVA_HOME” variable in system variables and browse directory where you installed JDK in your computer.
- Add another system variable “PATH” and browse directory where you installed JDK and select ‘bin’ folder.
- Now open your command prompt or terminal & type command ‘ java -version ’ to check whether you have successfully setup Java environment.
If you can see java version, it means you have successfully installed your Java environment. Otherwise, you can repeat all the steps above to do setup again.
Integrated Development Environment (IDE) for Java
vFor basic programs, you can use Notepad or Notepad++ as the code editor, compile code using ‘javac Program.class’ and run it using command ‘java Program’ using the command prompt. But for bigger applications, it comes difficult to handle application during development. To handle bigger programs, IDE can be used. An IDE is a software that provides facilities & tools to the programmers to program an application easily.
For Java, NetBeans & Eclipse are mostly used IDEs. You can practice any of them as the code editor.
- You can download “Netbeans IDE” from oracle.com
- You can download “Eclipse IDE” from eclipse.org
At the end of this chapter, you have an idea of what is JVM, how JVM works, what is JDK, what is JRE, what is IDE and how-to setup environment for Java. Your system is ready for Java application development. In next chapter, we will develop the understanding of some basic concepts and make our first program to print “Hello World” and proceed towards deeper techniques and details of Java.