Advertisement
Guest User

Untitled

a guest
Mar 5th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.Properties;
  3.  
  4. public class NewClass {
  5. public static void main(String args[]) throws IOException {
  6. Properties p = new Properties();
  7. p.load(new FileInputStream("DBDriverInfo.properties"));
  8. String url=p.getProperty("url");
  9. String user=p.getProperty("username");
  10. String pass=p.getProperty("password");
  11. System.out.println(url+"n"+user+"n"+pass);
  12. }
  13. }
  14.  
  15. Exception in thread "main" java.io.FileNotFoundException: DBDriverInfo.properties (The system cannot find the file specified)
  16. at java.io.FileInputStream.open(Native Method)
  17. at java.io.FileInputStream.<init>(FileInputStream.java:138)
  18. at java.io.FileInputStream.<init>(FileInputStream.java:97)
  19. at NewClass.main(NewClass.java:7)
  20.  
  21. File f = new File("DBDriverInfo.properties");
  22. System.out.println(f.getAbsolutePath());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement