Java is freely available on Oracle's Website. Download the latest version of JDK (Java Development Kit) on your machine.
Do check whether your machine is 32 bit or 64 bit and download that particular Java version. Install JDK on your machine.
Once you have installed Java on your machine you would need to set environment variable to point to correct installation directory.
An Environment variable is a dynamic "object" on a computer that stores a value (like a key-value pair), which can be referenced by one or more software programs in Windows.
Like for Java, we will set an environment variable with name "java" and its value will be the path of the /bin directory present in Java directory.
So whenever a program will require Java environment, it will look for the java environment variable which will give it the path to the execution directory.
Assuming that you have installed Java in C:\Program Files\Java\JDK directory.
PATH
environment variable and select it. Click Edit. If the PATH
environment variable does not exist, click New
.PATH
environment variable. Click OK. Close all remaining windows by clicking OK.PATH
environment variable and select it. Click Edit. If the PATH
environment variable does not exist, click New
.PATH
environment variable. Click OK. Close all remaining windows by clicking OK.PATH
environment variable and select it. Click Edit. If the PATH
environment variable does not exist, click New
.PATH
environment variable. Click OK. Close all remaining windows by clicking OK.PATH
environment variable and select it. Click Edit. If the PATH
environment variable does not exist, click New
.PATH
environment variable. Click OK. Close all remaining windows by clicking OK.To run a different version of Java, either specify the full path, or use the java_home
tool:
% /usr/libexec/java_home -v 1.8.0_73 --exec javac -version
% java -version
java
tool, if it can find it. If the version is old or you get the error java: Command not found, then the path is not properly set.% which java
Edit the startup file (~/.bashrc
)
PATH=/usr/local/jdk1.8.0/bin:$PATH
export PATH
% . /.profile
java
command% java -version
Edit the startup file (~/.cshrc
)
set path=(/usr/local/jdk1.8.0/bin $path)
% source ~/.cshrc
java
command% java -version
Ask Question