title: Wrapping a checked exception into an unchecked exception in Java?
body: <p>I have this factory method in java:</p>
  
  <pre><code>public static Properties getConfigFactory() throws ClassNotFoundException, IOException {
      if (config == null) {
          InputStream in = Class.forName(PACKAGE_NAME).getResourceAsStream(CONFIG_PROP);
          config = new Properties();
          config.load(in);
      }
      return config;
  }
  </code></pre>
  
  <p>And I want to transform the two checked exceptions into unchecked exceptions. What is the best way to go about this?</p>
  
  <p>Should I just catch the exception and throw a new RuntimeException using the caught exception as the inner exception?</p>
  
  <p>Is there a better way to do this or should I even be attempting to do this in the first place?</p>
  
  <p><strong>EDIT:</strong><br/>
  Just to clarify. These exceptions will be fatal, as the configuration file is essentially to the operation of the program and all exception will be caught and logged at the top level of my program.</p>
  
  <p>My purpose is to avoid an unnecessary throws exception, exception added to the signature of every method that calls my factory.</p>