If you’re a programmer and using windows 8 operating system on your laptop or desktop or even if you just upgraded to windows 8 from windows 7 operating system then you must download java for windows 8 and to run java programs, you must set java path and class path in your windows 8 operating system. Before setting required paths in your windows 8 PC or laptop, you must download and install java for windows 8. Here is a detailed guide which helps you download and install java for windows 8 and next to setup java path and class path in few simple easy steps.
Before setting java path and class path in java, one must know about what path exactly is? Path is an environmental variable which include the address of commands in java. whenever you write a command in command prompt, operating system looks for this path to execute those commands successfully.
Also Read: Best Windows 8 Tips and Tricks
Setting path is nothing but adding JDK bin directory to environment variable. JDK bin directory contains “java” and “javac” commands. javac command is used to compile java program and java command is used to run the compiled java program.
How to download java for windows 8 and install Java Development Kit (JDK)
Before setting java path and class path you must download java for windows 8. Here is a detailed tutorial to download and install Java Development Kit on windows 8 in few simple clicks.
Go with below link to download java for windows 8. Before downloading make sure you have selected correct file type including bit because 32-bit JDK may not work on 64-bit and vice versa.
Once download completes, run it as administrator and follow on-screen instructions to complete installation. It is recommend to install JDK in the same drive where operating system is being installed. In my case I installed in C drive.
How to set Java Path and Class Path in Java
Before setting java path in your system, let us make sure that path is not set earlier. Just press Ctrl+R and type cmd to open command prompt. In command prompt type javac and press enter.
If you see an error javac is not recognized as an internal or external command then it clearly says, java path is not set currently and we have to set the path.
Once you confirmed that path is not set, go to installation directory of JDK. Generally if you installed in C drive, it should look like this and Copy the entire address of that directory.
Now right click on my computer icon and select properties. From the left menu, click Advanced System Settings and then press Advanced in the popup windows displayed and ultimately click Environment Variables.
Under User variables, select path and click on edit. Now add ; at the end of the path and paste the address copied earlier and add another ; then click Ok. Again click Ok to save all changes we just made.
That’s all we made all necessary things to set java path in windows 8. Now just go to cmd, then type javac and hit enter. If you see lots of commands rather than a error in single line, then you’re done perfectly fine.
Make use of below sample problem to test whether your JDK is working fine or giving any errors on your machine.
public static void main(String args)
System.out.println("This tutorial is from Geek Dashboard");
In case if you face any difficulties while setting up path or while installing java for windows, let us know from comments section.