After a little testing, as I myself was having the same problem as the original poster, this problem is related to using Java Runtime Environment 7. MineCraft is designed using JRE6, and if it launches with JRE7 it will fail to connect. If this does not solve your issue or you do not have JRE7, then this fix is not for you. But most likely this will help a lot of people.
Fix 1: Simply remove JRE7 from your computer and install JRE6. If you are using a 64-bit system you can still install JRE6 x64 and should not experience problems with MineCraft.
Fix 2: If you would like to keep JRE7 but still need MineCraft to work, you will need to force MineCraft to start with JRE6. For this, you will obviously need to install JRE6 x86 or x64. Then, where you have your MineCraft.exe saved, right click and make a text file called MineCraft.txt or anything you'd like to call it.
In the file write..
Quote
@ECHO Off
"C:\Program Files\Java\JRE6\bin\java.exe" -jar MineCraft.exe
Exit
Click File, SAVE AS MineCraft.bat -- If you told Windows not to hide file extensions, you can simply name it MineCraft.bat to begin with and right click and click "Edit"
If you know what you are doing, you can also add in other parametres to extend memory usage and what not. The down side to this fix is that you will have the ugly command prompt boot up every time you start MineCraft (you will need to start MineCraft with this file). A few workarounds involve using scripts. Though pointing to javaw.exe instead of Java.exe will leave the command prompt blank, it won't get rid of it. One work around you can do is download the NSIS compiler and make an executable to do this for you.
If you decide to use this method, Google will lead you right to the NSIS compiler download. Then make a text file with this inside:
Quote
SilentInstall Silent
Name "MineCraft Launcher"
RequestExecutionLevel User
Section
Exec '"C:\Program Files\Java\JRE6\bin\javaw.exe" -jar MineCraft.exe"'
Quit
SectionEnd
OutFile "MineCraft Launcher.exe"
Save this file as minecraftlauncher.nsi, and use the NSIS compiler to compile the file and run it, it should not use any ugly command prompt windows.
Also, if you do not put this file in the same directory as the executable, it will fail to launch, so if you wish to put it elsewhere, replace "-jar MineCraft.exe" with "-jar ?:YourPath\MineCraft.exe" As well correct any other paths, such as if you use Java 32-bit on a 64-bit computer, make sure you write the path as "C:\Program Files (x86)\Java\JRE6\bin\javaw.exe"