URL error message

I am trying to read URLs with java.net.URL that may have 2 different error messages and I need to print the error messages. The problem I'm having is that both exceptions just say 500 error. How can I print the error message from the page?
[247 byte] By [sfejioefsjiosefja] at [2007-11-27 4:55:49]
# 1
Use InputStream returned from openStream() method.
hiwaa at 2007-7-12 10:10:50 > top of Java-index,Java Essentials,Java Programming...
# 2
I did but it throws an exception because the page is a 500 error. But I need it to read the page anyway, and print the error.
sfejioefsjiosefja at 2007-7-12 10:10:50 > top of Java-index,Java Essentials,Java Programming...
# 3
Or try URL's openConnection() method.
pbrockway2a at 2007-7-12 10:10:50 > top of Java-index,Java Essentials,Java Programming...
# 4
> I need it to read the pageYou can't if it is a 500 error.
hiwaa at 2007-7-12 10:10:50 > top of Java-index,Java Essentials,Java Programming...
# 5
can you plz give us ur code,so that we can try and see whts happening and it will be easy for us to help you out.cheersSandy
sandysharma2000a at 2007-7-12 10:10:50 > top of Java-index,Java Essentials,Java Programming...