Last active
August 29, 2015 13:56
-
-
Save hayasshi/6edddeee838a44beba27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object Resource { | |
// 実行時例外 | |
val prop1 = new Properties | |
prop1.load(new FileInputStream("config.properties")) // -> FileNotFoundExceptionが投げられる | |
// target/scala-ver/classes/config.propertiesが読み込まれる | |
// (コンパイル前: src/main/resources/config.properties) | |
val prop2 = new Properties | |
prop2.load(this.getClass().getClassLoader().getResourceAsStream("config.properties")) // -> 読み込む | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment