Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error with Url with java

 
david luis
Ranch Hand
Posts: 53
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Eclipse gives me these error with this code in java:

Error:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Unhandled exception type MalformedURLException

Could you help me please?

Many thanks and sorry for my english
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The definition of the URL class constructor says that it might throw a MalformedURLException. This is a checked exception, so your code needs to either catch or rethrow it. See the java exceptions tutorial for more details.
 
Campbell Ritchie
Sheriff
Posts: 48917
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and welcome to the Ranch
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic