You need some type of interface device like GuitarPort, PODxt, MiAudio Guitar Box, etc. (these are just a few). For more info, visit sites like
www.line6.com or
www.m-audio.com .
These devices come with software that allows you to hear (via headphones, computer speakers or monitors) you guitar.
Also, if you own a Mac with Garage Band, you can purchase an interface guitar cable for about $30.