For setting path variable in Windows 8 you have to follow below steps.
- Open Control Panel
- Click on System & Security
- Click on System
- Click on Advanced system setting. System Properties window dialog will be shown.
- Click on Environment Variables.
- Environment Variables window dialog be shown.Now under System variables section check for path Variable and edit it.
- Add JDK/bin folder path path into it.
- Now you can access javac,java command from command prompt with root directory too.