Set Environment Variable for Java in Windows 8,8.1
Defining JAVA_HOME is an important process after the installation of your JDK you must set the JAVA_HOME as your system variable, this is essential in the GlassFish ESB installation. another reason is most of the java IDE’s only work after JAVA_HOME is declared, the Android Studio not works until u set the JAVA_HOME variable.
Double click Computer
Select system properties
or
Right click computer > select properties
Click Advanced system settings
Click Environment Variables
Click new in System variables
Type JAVA_HOME as the variable name
in Variable value point where you installed the Java JDK,
the default location is C:Program FilesJavajdk1.8.0_25
click OK