Java is platform independent i.e. when you write the program and compile it . Then compiler will generate bytecode i.e. .class file .
This bytecode can run on any Java virtual machine (JVM) regardless of computer architecture.
You should know below things before setting the java environment –
- JDK(Java Development Kit) : JDK is intended for software developers and includes development tools such as the Java compiler, Javadoc, Jar, and a debugger.
- JRE(Java Runtime Environment) : JRE contains the parts of the Java libraries required to run Java programs and is intended for end users. JRE can be view as a subset of JDK.
- JVM: JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime environment in which java bytecode can be executed. JVMs are available for many hardware and software platforms.
Steps to install java and setting java path variables –
- Download Java8 JDK is available at Download Java 8.
2. Install java by clicling on .exe file and after that you need to setup java environment variables.
3. Go to Control Panel -> System and Security -> System -> Environment variables as highlighted below –
4. In java 8 on windows 10 , it creates a symbolic link to java environment automatically under path highlighted below –
So no need to set java path externally .
In windows 7 , you can save the path as below –
Set JAVA_HOME and add this variable in path system variables.
5. You are ready to use java now. Check if java is installed by firing java –version command on command line.