Netbeansでファイルを入力したいのですが、どのディレクトリに入れたら良いのでしょうか?
TestPropertyプロジェクト/ソース・パッケージ/testproperty内に入れていますが、"File Not Found"で返ってきます。すいません。よろしくお願いします。
package testproperty; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; public class TestProperty { public static void main(String[] args) { Properties prop = new Properties(); String filename = "data.txt"; try { FileInputStream in = new FileInputStream(filename); prop.load(in); } catch (IOException e) { System.out.println("File Not Found."); } String value = prop.getProperty("key1"); System.out.println(value); } }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/04/28 07:07