Saturday, November 26, 2011

How To Set Java Path


How do I set or change the PATH system variable?


This article applies to:
  • Platform(s): Solaris SPARC, Solaris x86, Red Hat Linux, SUSE Linux, Windows 7, Vista, Windows XP
  • Browser(s): All Browsers
  • Java version(s): All JRE Versions

MORE TECHNICAL INFORMATION

The PATH is the system variable that your operating system uses to locate needed executables from the command line or Terminal window.
The PATH system variable can be set using System Utility in control panel on Windows, or in your shell's startup file on Linux and Solaris.

SOLUTION

Setting Path on Windows
For Windows XP:
  1. Start -> Control Panel -> System -> Advanced
  2. Click on Environment Variables, under System Variables, find PATH, and click on it.
  3. In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
  4. Close the window.
  5. Reopen Command prompt window, and run your java code.

For Windows Vista:
  1. Right click "My Computer" icon
  2. Choose "Properties" from context menu
  3. Click "Advanced" tab ("Advanced system settings" link in Vista)
  4. In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
  5. Reopen Command prompt window, and run your java code.

Setting Path on Solaris and Linux
To find out if the java executable is in your PATH, execute:
% java -version

This will print the version of the java executable, if it can find it. If you get error java: Command not found. Then path is not properly set.

To find out which java executable the first one found in your PATH, execute:
% which java

For bash Shell:
  1. Edit the startup file (~/ .bashrc)
  2. Modify PATH variable:
    PATH=/usr/local/jdk1.6.0/bin
  3. export PATH
  4. Save and close the file
  5. Open new Terminal window
  6. Verify the PATH is set properly
    % java -version

For C Shell (csh):
  1. Edit startup file (~/ .cshrc)
  2. Set Path
    set path=(/usr/local/jdk1.6.0/bin )
  3. Save and Close the file
  4. Open new Terminal window
  5. Verify the PATH is set properly
    % java -version

How To Install Java


How To Install Java

How do I manually download and install Java for my Windows computer?


This article applies to:
  • Platform(s): Windows 7, Vista, Windows XP, Windows 2000, Windows 2003, Windows 2008 Server
  • Java version(s): 6.0

The procedure to install Java broadly consists of:
  1. Download and Install
  2. Test Installation
» Windows System Requirements

Typical download size is 10 MB, which is the minimum download. The size may increase if additional features are selected.

Note: User needs to have an administrative rights for downloading and installing Java on their system.


 
Download and Install
It is recommended, before you proceed with online installation you may want to disable your Internet firewall. In some cases the default firewall settings are set to reject all automatic or online installations such as the Java online installation. If the firewall is not configured appropriately it may stall the download/install operation of Java under certain conditions. Refer to your specific Internet firewall manual for instructions on how to disable your Internet Firewall.

  1. Go to the Manual download page
  2. Click on Windows Online
  3. The File Download dialog box appears prompting you to run or save the download file
    • To run the installer, click Run.
    • To save the file for later installation, click Save.
      Choose the folder location and save the file to your local system.
      Tip: Save the file to a known location on your computer, for example, to your desktop.
      Double-click on the saved file to start the installation process.
  1. The installation process starts. Click the Install button to accept the license terms and to continue with the installation.



  1. Oracle has partnered with companies that offer various products. The installer may present you with option to install these programs when you install Java. After ensuring that the desired programs are selected, click the Next button to continue the installation.



  1. A few brief dialogs confirm the last steps of the installation process; click Close on the last dialog.



  1. This will complete Java installation process.


NOTE: You may need to restart (close and re-open) your browser to enable the Java installation in your browser.