Skip to content

Instantly share code, notes, and snippets.

@jonasermert
Created December 22, 2021 00:44
Show Gist options
  • Save jonasermert/c6b67b858ee5c06b5f6980f59cdd7b25 to your computer and use it in GitHub Desktop.
Save jonasermert/c6b67b858ee5c06b5f6980f59cdd7b25 to your computer and use it in GitHub Desktop.

Revisions

  1. jonasermert created this gist Dec 22, 2021.
    21 changes: 21 additions & 0 deletions ReadPropertiesFileExample.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    import java.io.FileInputStream;
    import java.util.Properties;

    public class ReadPropertiesFile {
    public static void main(String[] args) {

    FileInputStream fis = new FileInputStream("Path to file");
    Properties prop = new Properties();
    prop.load(fis);

    String uName = prop.getProperty("username");
    String uPassword = prop.getProperty("password");

    System.out.println(uName);
    System.out.println(uPassword);


    }


    }