Tuesday, January 17, 2012

Set PATH for JDK 7 on Windows 8

You can run the JDK without setting the PATH environment variable, or you can optionally set it so that you can conveniently run the JDK executable files (javac.exe, java.exe, javadoc.exe, and so forth) from any directory without having to type the full path of the command.

To setup PATH in Windows 8:
Run Control Panel in Windows 8's Metro UI


Click More Settings in Control... on the left.


Search "Environment Variables" in Control Panel, and click "Edit the system environment variables".


Click on "Environment Variables..."


Scroll down to highligh and edit path items.


My full path of the bin folder of the JDK is:
C:\Program Files\Java\jdk1.7.0_02\bin

So add ";C:\Program Files\Java\jdk1.7.0_02\bin" in the path string.


Click OK... to finish.

Re-open Windows 8's "cmd" window, now i can start java and javac in anywhere.



Updated@2013-01-17: Set PATH environment variable to JDK on official Windows 8

Run "cmd" in Windows 8

To run "cmd" in Windows 8, move mouse cursor to the bottom-left corner in Metro UI, click Search in the pop-up menu.


Search "cmd", click on the listed icon of "cmd".


That's!

Install JDK 7 on Windows 8

Browse to Oracle download page(http://www.oracle.com/technetwork/java/javase/downloads/index.html) to download Java Platform (JDK), the current version is Java Platform (JDK) 7u2.
Browse to Oracle download page

Click to Accept License Agreement, select download Windows x86 ot x64. It's jdk-7u2-windows-i586.exe for Windows x86 in my case.
Download setup file

Execute the downloaded file.




Accept the Destination Folder, click Next.
Accept the Destination Folder


Click Continue button to continue JavaFx 2.0 SDK Setup.
JDK Setup complete

Install JavaFx 2.0 SDK Setup, click Next.
Install JavaFx 2.0 SDK Setup

Accept the JavaFx 2.0 SDK installation director.
Accept the JavaFx 2.0 SDK installation director



Complete by clicking on Close button.
JavaFX 2.0 SDK Setup - Complete

A browser will open for you to register your software.
register
In order to verify the setup correct, you have to run "cmd" in Windows. Refer to the article about how to run "cmd" in Windows 8.

Update to this step, you cannot run javac except you are in C:\Program Files\Java\jdk1.7.0_02\bin. Because you haven't set PATH.
Update to this step, you cannot run javac except you are in C:\Program Files\Java\jdk1.7.0_02\bin

To setup path, refer to the post "Set PATH for JDK 7 on Windows 8".

Refer to the post "Hello World of Java 7 on Windows 8, in 'cmd' DOS Prompt" to verify your JDK installation.


Updated@2013-01-17: Install JDK 7 on official Windows 8