Wo man eine properties-Datei?

Versuchte ich zu Lesen .Eigenschaften-Datei und code wie folgt:

public final class Config  {
  static {
    Properties properties = new Properties();
    InputStream propertiesStream = Object.class.getResourceAsStream("config.properties");

    if (propertiesStream != null) {
      try {
        properties.load(propertiesStream);
      } catch (IOException e) {
        e.printStackTrace();
      }
    } else {
      System.out.println("file not found");
    }
  }
}

aber es sagt immer Datei nicht gefunden.

Den Inhalt der Eigenschaften ist

pwd=passw0rd

Weiß jemand, wie man dieses problem lösen?

InformationsquelleAutor CSLearner | 2013-05-29
Schreibe einen Kommentar