0

みんな、時間と助けに感謝します。Java のプロパティ ファイルを作成および読み取るための Java フォームがあります。

たとえばconfig.properties、ファイルを書き込むことはできますが、読み取ろうとすると、間違った文字列情報が表示されます usename=a path=/home/a/desktop

private void formWindowOpened(java.awt.event.WindowEvent evt) { 

try { 
     InputStream inStream = new FileInputStream("config.properties"); 
     Properties rbReg = new Properties(); 
     rbReg.load(inStream); 
     DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); 
     DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); 
     Date date = new Date(); 

     text_box_smtp_server.setText(rbReg.getProperty("path")); 

     System.out.println(rbReg); 
} catch (Exception e) { 
     System.out.println("Error reading config file " + e); 
} 

{username = a、path = /home / a / Desktop}ではなく、{username = a、path = / home / a / Desktop}などのパスの内容でテキストを埋めたい。問題はテキストの形だけです、私は入ります。今、私は何をチェックしなければなりませんか?または変更しますか?

4

1 に答える 1