diff --git a/examples/glviewer.rb b/examples/glviewer.rb
index f1ab317acfed5af47aeb0aa6135ed61aa4356193..7ee88bc76624d318212465962b3c1ca6c7fb48bc 100755
--- a/examples/glviewer.rb
+++ b/examples/glviewer.rb
@@ -152,15 +152,9 @@ class GLViewWindow < FXMainWindow
 
   # Load the named PNG icon from a file
   def loadIcon(filename)
-    begin
-      filename = File.join("icons", filename) + ".png"
-      icon = nil
-      File.open(filename, "rb") do |f|
-        icon = FXPNGIcon.new(getApp(), f.read)
-      end
-      icon
-    rescue
-      raise RuntimeError, "Couldn't load icon: #{filename}"
+    filename = File.expand_path("../icons/#{filename}.png", __FILE__)
+    File.open(filename, "rb") do |f|
+      FXPNGIcon.new(getApp(), f.read)
     end
   end
 
diff --git a/examples/groupbox.rb b/examples/groupbox.rb
index 7f80a184aa742d67403d8e6502aa506f33d22c24..26a99b7aab207787d1c406614c1a938cb5d6f2fd 100755
--- a/examples/groupbox.rb
+++ b/examples/groupbox.rb
@@ -8,15 +8,9 @@ class GroupWindow < FXMainWindow
 
   # Convenience function to load & construct an icon
   def getIcon(filename)
-    begin
-      filename = File.join("icons", filename)
-      icon = nil
-      File.open(filename, "rb") { |f|
-        icon = FXPNGIcon.new(getApp(), f.read)
-      }
-      icon
-    rescue
-      raise RuntimeError, "Couldn't load icon: #{filename}"
+    filename = File.expand_path("../icons/#{filename}", __FILE__)
+    File.open(filename, "rb") do |f|
+      FXPNGIcon.new(getApp(), f.read)
     end
   end