This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP 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
Pie
Posts: 49785
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and welcome to the Ranch
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic