IT 言語

Javaでプロパティファイル取得に戸惑ったお話

以下処理でプロパティファイル呼べるはずだが、呼べない、、

		// プロパティファイルを読み込み
		Properties props = new Properties();
		InputStream is = null;
		InputStreamReader isr = null;
		try {
			is = DynamicRoutingDataSourceResolver.class.getClassLoader().getResourceAsStream("***.properties");
			isr = new InputStreamReader(is, "UTF-8");
			props.load(isr);
		} finally {
			if (isr != null) {
				isr.close();
			}
			if (is != null) {
				is.close();
			}
		}

なんでやねん!よべない、、、

と1時間近く悩んだが、propertiesファイルをクラスパスに含めるの忘れてた、、、

残念、、

Eclipse > 右クリック > ビルドパスの構成 > プロパティファイルの置き場所をソース・フォルダの追加

-IT, 言語