Monday 19 December 2011

How to restore Windows XP to a previous state

This article describes how to use the System Restore tool to return your computer to a previous state. System Restore takes "snapshots" of critical system files and some program files and registry settings and stores this information as restore points. If your computer is not functioning correctly, you can use these restore points to return Windows XP to a previous state when your computer was functioning correctly. It can also change scripts, batch files, and other kinds of executable files on your computer.

To perform the System Restore, you must be logged on to Windows as an administrator. If your computer is part of a network, you might have to ask the system administrator for help. To verify that you are logged on to Windows as an administrator, follow these steps:
  1. Open the Date and Time dialog box.
    1. Click Start, and then click Run.
    2. Type the following command in the Run dialog box, and then press OK:
      timedate.cpl
      Collapse this imageExpand this image
  2. Use one of the appropriate steps, depending on the result.
    • If the Date and Time Properties dialog box appears, you are already logged on as an administrator. Click Cancel to close the Date and TimeProperties dialog box.
      Collapse this imageExpand this image
    • The following message appears if you are not logged on as an administrator.
      Collapse this imageExpand this image

How to use System Restore to restore Windows XP to a previous state

Click here to view or hide step-by-step instructions with pictures

To use System Restore to restore Windows XP to a previous state, follow these steps:
  1. Log on to Windows as an administrator.
  2. Click Start, point to All Programs, point to Accessories, point to System Tools, and then click System Restore.
    Collapse this imageExpand this image
  3. On the Welcome to System Restore page, click to select the Restore my computer to an earlier time option, and then click Next.
    Collapse this imageExpand this image
  4. On the Select a Restore Point page, click the most recent system restore point in the On this list, click a restore point list, and then click Next.
    Note A System Restore message may appear that lists configuration changes that System Restore will make. Click OK.
    Collapse this imageExpand this image
  5. On the Confirm Restore Point Selection page, click Next. System Restore restores the previous Windows XP configuration, and then restarts the computer.
  6. Log on to the computer as an Administrator. Then click OK on the System Restore Restoration Complete page.
    Collapse this imageExpand this image
If you successfully restored your computer to a previous state, and the computer performs as expected, you are finished.

 

How to undo a system restoration after you perform a System Restore

Click here to view or hide step-by-step instructions with pictures

You may have unintentionally restored Windows XP to a previous configuration that you do not want. To undo the restoration, follow these steps:
  1. Log on to Windows as an administrator.
  2. Click Start, point to All Programs, point to Accessories, point to System Tools, and then click System Restore.
    Collapse this imageExpand this image
  3. On the Welcome to System Restore page, click to select the Undo my last restoration option, and then click Next.
    Note A System Restore message may appear that lists configuration changes that System Restore will make. Click OK.
    Collapse this imageExpand this image
  4. On the Confirm Restoration Undo page, click Next. System Restore restores the original Windows XP configuration, and then restarts the computer.
  5. Log on to the computer as Administrator. The System Restore Undo Complete page appears.
    Collapse this imageExpand this image
  6. Click OK. You can now run System Restore again from a different restore point.
For additional information about steps to take if the System Restore tool in Windows XP does not start, click the following article number to view the article in the Microsoft Knowledge Base:
304449 How to start the System Restore tool from a command prompt in Windows XP
For additional information about System Restore,
  1. Click Start.
  2. Click Help and Support.
  3. Type system restore in the Search box, and then press ENTER.

How to repair the operating system and how to restore the operating system configuration to an earlier point in time in Windows Vista

This article discusses how to repair the operating system and how to restore the operating system configuration to an earlier point in time in Windows Vista. It describes how to use the System File Checker tool to scan and replace system files in scenarios where you are troubleshooting an issue in Windows Vista. It also discusses how to use the System Restore tool to restore the operating system configuration to an earlier point in time.

The System File Checker tool

To determine whether the issue that you are experiencing is caused by one or more system files that are used by Windows Vista, run the System File Checker tool. The System File Checker tool scans system files and replaces incorrect versions of the system files by using the correct versions.

To run the System File Checker tool, follow these steps:
  1. Click Start
    Collapse this imageExpand this image
    Start button
    , and then type cmd in the Start Search box.
  2. Right-click cmd in the Programs list, and then click Run as administrator.

    Collapse this imageExpand this image
     User Account Control permission
    If you are prompted for an administrator password or confirmation, type your password or click Continue
  3. At the command prompt, the following line, and then press ENTER:
    sfc /scannow
When the scan is complete, test to see whether the issue that you are experiencing is resolved. If the issue that you are experiencing is not resolved, use the procedure that is described in the "The System Restore tool" section.

The System Restore tool

Other troubleshooting methods, such as using the System File Checker tool, may not resolve the issue. If they do not resolve the issue, and the issue that you are experiencing started occurring recently, you can use the System Restore tool. By using this tool, you can restore the computer to an earlier point in time.

Using the System Restore tool may not necessarily help you determine the issue. The System Restore tool uses restore points to return system files and settings to an earlier point in time. You can use it to restore the operating system to a point in time in which you did not experience the issue. When you use System Restore to restore the computer to a previous state, programs and updates that you installed are removed.

To restore the operating system to an earlier point in time, follow these steps:
  1. Click Start
    Collapse this imageExpand this image
    Start button
    , type system restore in the Start Search box, and then click System Restore in the Programs list.

    Collapse this imageExpand this image
     User Account Control permission
    If you are prompted for an administrator password or confirmation, type your password or click Continue.
  2. In the System Restore dialog box, click Choose a different restore point, and then click Next.
  3. In the list of restore points, click a restore point that was created before you began to experience the issue, and then click Next.
  4. Click Finish.

    The computer restarts, and the system files and settings are returned to the state that they were in at the time that the restore point was created.

Sunday 18 December 2011

Determine how much RAM you have and how much you need

If it suddenly seems that your computer can't keep up and the drive light is flickering like crazy, it's probably time to install RAM. But before you unplug the cables, lug the machine to the car, drive to the computer store, wait to have RAM installed, and pay for the service, read how to install RAM yourself.
Note: Problems with speed can also be caused by viruses, spyware, or other malicious software. Make sure that your virus checker is up to date. Or download Microsoft Security Essentials for free.

Determine how much RAM you have and how much you need

Before you buy anything, you need to know how much memory you have and what type of memory to buy.
Find out how much RAM your computer has
You can find out how much RAM is installed in your computer in two ways. You can open the System Information dialog box to see the installed physical memory, or you can go to Control Panel.
To open System Information, click Start, click All Programs, click Accessories, click System Tools, and then click System Information. In the left pane, select System Summary. The Installed Physical Memory (RAM) entry in the list tells you how much RAM your computer has.
System information dialog box with Installed Physical Memory (RAM) circledThe Installed Physical Memory (RAM) entry in the System Information list tells you how much RAM your computer has.
Go to Control Panel in your version of the Windows operating system to find out how much RAM your computer has:

Windows XP

  • In Windows XP, go to the Start menu, click Settings, and then click Control Panel. Click System, and then select the General tab. At the bottom of the page you will see the amount of RAM.
Find out how much RAM you need
Most games specify the minimum amount of RAM you need to install and play. For example, Harry Potter and the Prisoner of Azkaban requires 256 megabytes (MB). This amount includes RAM that the computer needs to do its own background work in addition to running the game.
The amount of RAM you need depends on the operating system you are using. For systems running Windows 7, Windows Vista, or Windows XP, you should have the minimum recommended amount, but more can be better, depending on your needs. If you just use your PC for surfing the Internet and writing letters, you may need only the minimum amount of RAM required to run the version of Windows you have installed on your computer. But for the best performance—especially if you keep several programs open at the same time while you’re working—consider increasing the RAM on your computer to at least 2 gigabytes (GB).
See the minimum amount of RAM required for your version of Windows:
For more RAM-intensive programs, such as games or photo editing, or if you like to use a lot of applications at the same time, such as desktop publishing and video rendering, you may need additional RAM. Individual programs come with system requirements that show both the minimum RAM needed to run the program, and the amount of RAM needed for its best performance.
You can buy RAM modules in a variety of sizes, typically 1-GB, 2-GB, and 4-GB modules.

Figure out what type of RAM you need

To determine the maximum amount of RAM your computer can handle along with the speed, consult your PC owner's manual, which should show you the number of slots (the place where you insert the RAM), how much RAM each can take, and the maximum RAM your system can use.
Contact the manufacturer or use an online memory advisor, such as those from Crucial Technology or Kingston Technology. These memory advisors use information that you enter about your computer model and do a memory check for your specific PC that tells you which products work with your system.
To find out what kind of module you need, you can also open up your computer.
  1. First, turn off the computer, but leave it plugged in so that it's automatically grounded. (Computers that should not remain plugged in will be clearly marked.)
  2. Place the computer on a clean workspace and remove the cover carefully (you may need to use a screwdriver).
  3. Touch the case to ground yourself. When you touch the case, it discharges static electricity that could otherwise damage your computer. (Note that some manuals recommend anti-static wrist straps, but this is not necessary for home users.)
  4. Locate the RAM modules, which are green with black tubes, on the motherboard.
  5. Now determine the type of module you have. You can identify the type by its appearance.
    • RDRAM is paired up (you have to put in two at a time) and has metal casing on one side.
    • DDR SDRAM is the most popular and looks like regular RAM but has one notch.
    • SDRAM (which is being phased out) has two notches.
  6. Also note your RAM speed, which is usually written on the side of the existing chip (either 266 or 333).
  7. If you don't have a free slot, remove one of the memory cards to check the number of notches on it. You will replace the smaller of the two RAM modules.
  8. Buy RAM.

Install your new RAM

  1. Turn off the computer, and touch the metal casing.
    Note: If you have a computer that should not remain plugged in while you work on it, turn off the computer and unplug the power cord. Then, press the button that turns on the power to your computer. This action helps you to be sure that there is no residual power to the memory slots or the computer's motherboard. The board also may have an LED light that is lit, which is another indication that there is residual power.
  2. Open the compartment where your RAM is installed. You may have to remove screws to open the compartment. Note that this example is for a laptop computer. If you have a desktop computer, refer to the user manual to locate the RAM. You will have to remove the computer's cover.
    Photograph of a RAM compartmentYou may need to use a screwdriver to open the compartment where RAM modules are installed.
  3. Locate the RAM modules (RAM cards). Find the empty slot where you plan to add a module, or remove the RAM module you are replacing.
    A RAM module ready to install in an open slotThis open slot is ready for a 1-GB RAM module.
  4. Line up the notches of the new RAM module, and apply firm pressure to attach.
  5. After you're sure the RAM module is snugly in place, close the latch at either end. If you have clips, they should snap back in place.
    A newly installed RAM moduleThe RAM module has been installed and is snugly in place.
  6. Reconnect all the cables, but leave the casing open until you're sure everything is working right.
  7. Turn your computer back on. If the machine starts to beep, the memory is either incompatible or not correctly in its slot. If you've installed everything correctly, the system will detect the new RAM.
  8. Check your system information to see how much RAM you now have. If you replaced a 512-MB module with a 1-GB one, you should have 1 GB (1,024 MB) minus 512 —or 512 MB more RAM than you did previously. If you added the RAM but didn't remove any, you should have 1 GB more RAM, for a total of 1.5 GB.
  9. Try one of your programs that wasn't working well. If it still isn't working, unplug everything again and get back into the computer to check that the RAM modules are firmly secured.

Quick facts about RAM

RAM = random access memory. RAM is the primary working memory in a computer used for the temporary storage of programs and data and in which the data can be accessed directly and modified.
RAM is measured in bytes: 1 gigabyte (GB) = 1,024 megabytes (MB) = 1,048,576 kilobytes (KB)

How to Install RAM

How to Install RAM

How to Install RAMthumbnail
Install RAM

If your computer slows down when you're working with large files or many programs at once, you might be able to improve performance by installing extra RAM (Random Access Memory - your computer's temporary operating memory).

Instructions

Things You'll Need

  • RAM
  • Surge Protectors
    • 1
      Determine what kind of RAM you need, and whether your computer has enough open slots to hold it. The new RAM should match the existing RAM's specifications and configuration.
    • 2
      Shut down the computer and leave it plugged into the surge suppressor.
    • 3
      Disconnect all peripheral devices, such as the monitor, from the computer.
    • 4
      Remove the computer cover.
    • 5
      Ground yourself to the computer with professional grounding equipment like an anti-static wristband or hold a metal part of the chassis.
    • 6
      Remove any cards or internal components necessary to give yourself unobstructed access to RAM sockets.
    • 7
      Pick up your SIMM (single in-line memory module) or DIMM (dual in-line memory module) by the ends without touching pins or chips.
    • 8
      If adding a SIMM, find the notched end and turn the SIMM so that it is parallel to the existing RAM card(s). Insert the SIMM into the socket at a 30-degree angle. If adding a DIMM, insert the DIMM straight in so that it is perpendicular to the motherboard.
    • 9
      Use slight pressure to keep a SIMM from backing out while rotating the module to an upright position perpendicular to the motherboard.
    • 10
      Make sure the small holes on each side of a SIMM fit into holders.
    • 11
      Feel or hear retaining clips lock a SIMM into the socket; close the side clips on a DIMM.
    • 12
      Gently try to pull the module out to ensure it is locked in position.
    • 13
      Replace all internal components.
    • 14
      Leave the cover off and reconnect the monitor, keyboard and mouse.
    • 15
      Turn on the computer.
    • 16
      Check the amount of RAM by right-clicking the My Computer icon in Windows and choosing Properties. On a Mac, use the About this Macintosh command in the Apple menu.
    • 17
      If you don't see the right amount of RAM, turn off the computer and try "reseating" the SIMM or DIMM (take it out and put is back in) and reboot. If that doesn't work, call a technician.
    • 18
      Shut down the computer and disconnect the peripherals again.
    • 19
      Replace the cover and reconnect all the peripherals.

Saturday 17 December 2011

How to Install Windows XP ON YOUR PC

This procedure demonstrates how to install Windows XP Professional. The procedure to install Windows XP home edition is very similar to the professional edition. Since Windows XP Pro is more advanced operating system, it will be used to demonstrate the installation procedure.
The best way install Windows XP is to do a clean install. It is not difficult to perform a clean installation. Before you perform the installation I recommend that you check Windows XP Compatibility List to ensure that your hardware is supported by XP. If your hardware is not on the compatibility list you can check your hardware manufactures website to download the drivers for Windows XP. Save all the necessary drivers onto floppy disks or CD before you start the installation.

Step 1 - Start your PC and place your Windows XP CD in your CD/DVD-ROM drive. Your PC should automatically detect the CD and you will get a message saying "Press any key to boot from CD". Soon as computer starts booting from the CD your will get the following screen:
Windows XP Screenshot - Click to enlarge
Step 2 - At this stage it will ask you to press F6 if you want to install a third party Raid or SCSI driver. If you are using a an IDE Hard Drive then you do not need to press F6. If you are using a SCSI or SATA Hard drive then you must press F6 otherwise Windows will not detect your Hard Drive during the installation. Please make sure you have the Raid drivers on a floppy disk. Normally the drivers are supplied on a CD which you can copy to a floppy disk ready to be installed. If you are not sure how to do this then please read your motherboard manuals for more information.
Windows XP Screenshot - Click to enlarge
Step 3 - Press S to Specify that you want to install additional device.
Windows XP Screenshot - Click to enlarge
Step 4 - You will be asked to insert the floppy disk with the Raid or SCSI drivers. Press enter after you have inserted the disk.
Windows XP Screenshot - Click to enlarge
Step 5 - You will see a list of Raid drivers for your HDD. Select the correct driver for your device and press enter.
Step 6 - You will then get a Windows XP Professional Setup screen. You have the option to do a new Windows install, Repair previous install or quit. Since we are doing a new install we just press Enter to continue.
Step 7 - You will be presented with the End User Licensing Agreement. Press F8 to accept and continue
Windows XP Screenshot - Click to enlarge
Step 8 - This step is very important. Here we will create the partition where Windows will be installed. If you have a brand new unformatted drive you will get a screen similar to below. In our case the drive size is 8190MB. We can choose to install Windows in this drive without creating a partition, hence use the entire size of the drive. If you wish to do this you can just press enter and Windows will automatically partition and format the drive as one large drive.
However for this demonstration I will create two partition. The first partition will be 6000MB (C: drive) and second partition would be 2180MB (E: drive). By creating two partition we can have one which stores Windows and Applications and the other which stores our data. So in the future if anything goes wrong with our Windows install such as virus or spyware we can re-install Windows on C: drive and our data on E: drive will not be touched. Please note you can choose whatever size partition your like. For example if you have 500GB hard drive you can have two partition of 250GB each.
Press C to create a partition.
Windows XP Screenshot - Click to enlarge
Step 8 - Windows will show the total size of the hard drive and ask you how much you want to allocate for the partition you are about to create. I will choose 6000MB. You will then get the screen below. Notice it shows C: Partition 1 followed by the size 6000 MB. This indicates the partition has been created. We still have an unpartitioned space of 2189MB. Next highlight the unpartitioned space by pressing down the arrow key. Then press C to create another partition. You will see the total space available for the new partition. Just choose all the space left over, in our case 2180MB.

Step 9 - Now you will see both partition listed. Partition 1 (C: Drive) 6000MB and Partition 2 (E: Drive) 2180MB. You will also have 8MB of unpartitioned space. Don't worry about that. Just leave it how its is. Windows normally has some unpartitioned space. You might wonder what happened to D: drive. Windows has automatically allocated D: drive to CD/DVD-ROM.
Select Partition 1 (C: Drive) and press Enter.

Windows XP Screenshot - Click to enlarge

Step 10 - Choose format the partition using NTFS file system.This is the recommended file system. If the hard drive has been formatted before then you can choose quick NTFS format. We chose NTFS because it offers many security features, supports larger drive size, and bigger size files.
Select Partition 1 (C: Drive) and press Enter.
Windows XP Screenshot - Click to enlarge


Windows will now start formatting drive C: and start copying setup files as shown on the two images below :
Step 11 - After the setup has completed copying the files the computer will restart. Leave the XP CD in the drive but this time DO NOT press any key when the message "Press any key to boot from CD" is displayed. In few seconds setup will continue. Windows XP Setup wizard will guide you through the setup process of gathering information about your computer.
Windows XP Screenshot - Click to enlarge
Step 12 - Choose your region and language.
Windows XP Screenshot - Click to enlarge
Step 13 - Type in your name and organization.
Windows XP Screenshot - Click to enlarge
Step 14. Enter your product key.
Windows XP Screenshot - Click to enlarge
Step 15 - Name the computer, and enter an Administrator password. Don't forget to write down your Administrator password.
Windows XP Screenshot - Click to enlarge
Step 16 - Enter the correct date, time and choose your time zone.
Windows XP Screenshot - Click to enlarge
Step 17 - For the network setting choose typical and press next.
Windows XP Screenshot - Click to enlarge
Step 18 - Choose workgroup or domain name. If you are not a member of a domain then leave the default settings and press next. Windows will restart again and adjust the display.
Windows XP Screenshot - Click to enlarge



Step 19 - Finally Windows will start and present you with a Welcome screen. Click next to continue.
Windows XP Screenshot - Click to enlarge
Step 20 - Choose 'help protect my PC by turning on automatic updates now' and press next.
Windows XP Screenshot - Click to enlarge
Step 21 - Will this computer connect to the internet directly, or through a network? If you are connected to a router or LAN then choose: 'Yes, this computer will connect through a local area network or home network'. If you have dial up modem choose: 'No, this computer will connect directly to the internet'. Then click Next.
Windows XP Screenshot - Click to enlarge
Step 22 - Ready to activate Windows? Choose yes if you wish to active Windows over the internet now. Choose no if you want to activate Windows at a later stage.
Windows XP Screenshot - Click to enlarge
Step 23 - Add users that will sign on to this computer and click next.
Windows XP Screenshot - Click to enlarge
Step 24 - You will get a Thank you screen to confirm setup is complete. Click finish.
Windows XP Screenshot - Click to enlarge
Step 25. Log in, to your PC for the first time.
Windows XP Screenshot - Click to enlarge
Step 26 - You now need to check the device manager to confirm that all the drivers has been loaded or if there are any conflicts. From the start menu select Start -> Settings -> Control Panel. Click on the System icon and then from the System Properties window select the Hardware tab, then click on Device Manager.
Windows XP Screenshot - Click to enlarge
If there are any yellow exclamation mark "!" next to any of the listed device, it means that no drivers or incorrect drivers has been loaded for that device. In our case we have a Video Controller (VGA card) which has no drivers installed.
Your hardware should come with manufacturer supplied drivers. You need to install these drivers using the automatic setup program provided by the manufacturer or you need to manually install these drivers. If you do not have the drivers, check the manufacturers website to download them.
To install a driver manually use the following procedure:
(a) From the device manager double click on the device containing the exclamation mark.
(b) This would open a device properties window.
(c) Click on the Driver tab.
(d) Click Update Driver button. The Wizard for updating device driver pops up as shown below:
Windows XP Screenshot - Click to enlarge
You now get two options. The first option provides an automatic search for the required driver. The second option allows you to specify the location of the driver. If you don't know the location of the driver choose the automatic search which would find the required driver from the manufacturer supplied CD or Floppy disk. Windows would install the required driver and may ask you to restart the system for the changes to take affect. Use this procedure to install drivers for all the devices that contain an exclamation mark. Windows is completely setup when there are no more exclamation marks in the device manager.

HOW TO INSTALL JAVA ON YOUR PC

How to install the JDK


Microsoft Windows 95

Installing the JDK

  1. Run the setup program jdk-1_5_0-windows-i586.exe
    Running the setup program.
  2. Click "Continue" on the warning message.
    Warning message.
  3. Click "Accept Terms in License Agreement" then click on the Next button.
    Licence Agreement.
  4. Select the components to install. If you are low on free space you can leave out the Demos and Source Code.
    Components to Install
  5. The wizard will now install the JDK files on your system. This may take a while.
    Installing the files
  6. Click the Next button to install the J2SE Runtime Environment
    Install the Java Runtime Environment
  7. In the next dialog select the browsers to integrate the JRE with, I recommend all. Click the Next button.
  8. The installation should be complete! Click the Finish button.
    Installation complete

Setting the Path Variable

We need to set the path variable so that the system can find the Java compiler.
  1. Open the Windows Explorer and navigate to the C:\ drive. Right-click on the file named Autoexec.bat and select edit from the menu.
    Edit the autoexec.bat file
    Warning
    Autoexect.bat may not be visible if it is set as a hidden file. You should set folder options to display hidden files by selecting Options from the Folder menu.
  2. The file may be empty, but it will most likely contain some entries. You should add the following entries at the bottom of the file, after the last entries:
    set JAVA_HOME=C:\Program Files\Java\jdk1.5.0
    set PATH="%PATH%;%JAVA_HOME%\bin"
    Note
    If you changed the installation location of java to some other location, you will have to change the location here to.
  3. Save the file, close the text editor and restart your computer.

Microsoft Windows 98

Installing the JDK

  1. Run the setup program jdk-1_5_0-windows-i586.exe
    Running the setup program.
  2. If you use Windows 98 First Edition and get the warning message, click "Continue" on the warning message.
    Warning message.
  3. Click "Accept Terms in License Agreement" then click on the Next button.
    Licence Agreement.
  4. Select the components to install. If you are low on free space you can leave out the Demos and Source Code.
    Components to Install
  5. The wizard will now install the JDK files on your system. This may take a while.
    Installing the files
  6. Click the Next button to install the J2SE Runtime Environment
    Install the Java Runtime Environment
  7. In the next dialog select the browsers to integrate the JRE with, I recommend all. Click the Next button.
  8. The installation should be complete! Click the Finish button.
    Installation complete

Setting the Path Variable

We need to set the path variable so that the system can find the Java compiler.
  1. Open the Windows Explorer and navigate to the C:\ drive. Right-click on the file named Autoexec.bat and select edit from the menu.
    Edit the autoexec.bat file
    Warning
    Autoexect.bat may not be visible if it is set as a hidden file. You should set folder options to display hidden files by selecting Options from the Folder menu.
  2. The file may be empty, but it will most likely contain some entries. You should add the following entries at the bottom of the file, after the last entries:
    set JAVA_HOME=C:\Program Files\Java\jdk1.5.0
    set PATH="%PATH%;%JAVA_HOME%\bin"
    Note
    If you changed the installation location of java to some other location, you will have to change the location here to.
  3. Save the file, close the text editor and restart your computer.

Microsoft Windows 2000

Installing the JDK

Note
You should be logged in as Administrator or have Administrative privileges to perform this installation. If not, you should get your System Administrator to do the install for you.
  1. Run the jdk-1_5_0-windows-i586.exe setup program.
  2. Select Accept with the Terms in the License Agreement and click the Next button.
    Accept the terms in the licence
  3. Select the components you wish to install. If you are low on disk space you can leave out the Demos and Source Code. Click the Next button to continue.
    Select components to install
  4. The installer will now copy files to your computer, this may take a while.
    Copying files to your computer
  5. Install the Public Java Runtime Environment by clicking the Next button. You should not have to edit any settings here.
    Install the runtime environment
  6. Select which browsers to integrate the runtime environment with. I recommend all.
    Select browsers to integrate the runtime with
  7. That should take care of the installation. The JDK is now successfully installed on your system.
    Installation completed.

Setting the Path Variable

We need to set the path variable so that the system can find the Java compiler.
Note
We will create the variables in the global system space so that any user on the system can use the java tools. If you don't want this, you can create the variables in the Administrator's user space, but then only the administrator will be able to use the java tools. This might be what you want if there is only one user on the computer.
  1. Right click on the My Computer icon on the desktop and select Properties from the pop up menu. Click the Environment Variables button.
    My Computer Properties
  2. Under the System Variables section click the New button to add a new variable.
    Environment Variables
  3. Add a variable named JAVA_HOME with the value C:\Program Files\Java\jdk1.5.0 and click the Ok button.
    The Java Home Variable
    Note
    If you installed Java to a different location, you should change the value here to reflect this.
  4. Lastly edit the variable named PATH, add a semi colon (;) after the last entry in the value field and then add C:\Program Files\Java\jdk1.5.0\bin
    The PATH variable

Microsoft Windows XP

Installing the JDK

Note
You should be logged in as Administrator or have Administrative privileges to perform this installation. If not, you should get your System Administrator to do the install for you.
  1. Run the jdk-1_5_0-windows-i586.exe setup program.
    Run the setup program
  2. Select Accept with the Terms in the License Agreement and click the Next button.
    Accept the terms in the licence
  3. Select the components you wish to install. If you are low on disk space you can leave out the Demos and Source Code. Click the Next button to continue.
    Select components to install
  4. The installer will now copy files to your computer, this may take a while.
    Copying files to your computer
  5. Install the Public Java Runtime Environment by clicking the Next button. You should not have to edit any settings here.
    Install the runtime environment
  6. Select which browsers to integrate the runtime environment with. I recommend all.
    Select browsers to integrate the runtime with
  7. That should take care of the installation. The JDK is now successfully installed on your system.
    Installation completed.

Setting the Path Variable

We need to set the path variable so that the system can find the Java compiler.
Note
We will create the variables in the global system space so that any user on the system can use the java tools. If you don't want this, you can create the variables in the Administrator's user space, but then only the administrator will be able to use the java tools. This might be what you want if there is only one user on the computer.
  1. Right click on the My Computer icon on the desktop and select Properties from the pop up menu. Click the Environment Variables button.
    My Computer Properties
  2. Under the System Variables section click the New button to add a new variable.
    Environment Variables
  3. Add a variable named JAVA_HOME with the value C:\Program Files\Java\jdk1.5.0 and click the Ok button.
    The Java Home Variable
    Note
    If you installed Java to a different location, you should change the value here to reflect this.
  4. Lastly edit the variable named PATH, add a semi colon (;) after the last entry in the value field and then add C:\Program Files\Java\jdk1.5.0\bin
    The PATH variable

Linux (Red Hat, Fedora Core & Mandrake)

Installing the JDK

Note
This how-to assumes you have root privileges and that you are to install Java system wide so that all users can use the Java tools.
  1. Start a shell. Copy the Linux installer to the /usr/local directory.
    cp jdk-1_5_0-linux-i586.bin /usr/local
  2. Now change into the /usr/local directory and run the installer.
    cd /usr/local
    chmod +x jdk-1_5_0-linux-i586.bin
    ./jdk-1_5_0-linux-i586.bin
  3. Read through the license agreement and if you agree type yes. This will start the installer.
  4. If everything goes well you should end up with output that ends with:
    Done.

Setting the Path Variable

  1. Create the file named java.sh in the directory named /etc/profile.d using your favourite text editor. I used Vi.
    cd /
    touch /etc/profile.d/java.sh
    vi /etc/profile.d/java.sh
  2. Add the following to the file.
    export JAVA_HOME=/usr/local/jdk1.5.0
    export PATH=${PATH}:${JAVA_HOME}/bin
  3. Make the script executable.
    chmod +x /etc/profile.d/java.sh
  4. Log out and then log in again for the changes to take effect.

Sun Solaris

The JDK should be installed and setup by default. For information on upgrading go to Sun's Website and browse through the Solaris documentation.

MacOS

Most newer versions of MacOS have the JDK installed and setup by default. For information on upgrading check out the MacOS documentation.

Compiling and Running Java Programs

Compiling Java Programs

We will now test our installation by compiling and running a simple Java Program.

Microsoft Windows

  1. Open the Notepad text editor Start > All Programs > Accessories > Notepad and type the following program into it:
    class HelloWorld {
        public static void main(String[] args) {
            System.out.println("Hello World!");
        }
    }
  2. Save the program to the C:\ drive in a file named HelloWorld.java. Make sure to select "All Files" in the Type field of the Save As dialog box.
  3. To compile the program, open the Dos Prompt Start > All Programs > Accessories > Command Prompt and type:
    cd\
    javac HelloWorld.java
    If you don't get any errors then everything went well. If you get errors, check firstly that you saved the program on the C:\ drive and that it is named HelloWorld.java.

Linux

  1. Start your favourite text editor and type the following program in it, then save it in a file named HelloWorld.java in your home directory.
    class HelloWorld {
        public static void main(String[] args) {
            System.out.println("Hello World!");
        }
    }
  2. To compile the program, start a shell and use the Java Compiler:
    cd ~
    javac HelloWorld.java
    If you don't get any errors then everything went well. If you get errors, check firstly that you saved the program in your home directory and that it is named HelloWorld.java.

Solaris

  1. Start a text editor, either vi in the command line or Gedit. Type the following program in it then save it in a file name HelloWorld.java in your home directory.
    class HelloWorld {
        public static void main(String[] args) {
            System.out.println("Hello World!");
        }
    }
  2. To compile the program, start a shell and use the Java Compiler:
    cd ~
    javac HelloWorld.java
    If you don't get any errors then everything went well. If you get errors, check firstly that you saved the program in your home directory and that it is named HelloWorld.java.

Running Java Programs

  1. To run the program, type:
    java HelloWorld
    you should get the following output:
    Hello World!

Common Errors and Solutions

  1. Exception in thread "main" java.lang.NoSuchMethodError: main You must define a main method as: public static void main(String[] args) {...}
  2. HelloWorld.java:3: illegal character: \8220 System.out.println(öHelloWorld!ö); Do not type your code in a word processor application that uses smart quotes!!
  3. HelloWorld.class Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld/class The correct way to call a program is java HelloWorld without the ".java" or ".class"

Valuable Resources

The Java Application Programmer Interface

The Java API is an Application Programmer Interface that describes in great detail the core Java Foundation Classes that make up the Java Platform. It highlights which packages make up the Platform, which classes belong to which packages and what methods and fields are available in each class. It is an invaluable tool to any Java Programmer.
The Java API

Sun's Java Page

Sun Microsystems's Java page can be accessed via the Internet at http://java.sun.com and it provides a download page where you can download all of the Java Technology that you want. It includes documentation: API's, Tutorials, Short Courses and White Papers. It often has industry news and updates and is also an invaluable resource to any Java programmer.
Sun't Java Page