Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. import java.io.IOException;
  2.  
  3.  
  4. public class main {
  5.  
  6. /**
  7. * @param args the command line arguments
  8. */
  9.  
  10.  
  11. public static void main(String[] args) throws IOException{
  12. timeKeepHome ja = new timeKeepHome();
  13. //ja.setVisible(true);
  14. fileTimeLog log = new fileTimeLog();
  15.  
  16.  
  17. log.checkFile();
  18.  
  19. }
  20.  
  21. }
  22.  
  23. import java.io.IOException;
  24. import java.io.File;
  25. import java.io.FileNotFoundException;
  26. import java.io.PrintWriter;
  27. import java.util.Scanner;
  28. import java.util.Date;
  29. import java.text.DateFormat;
  30. import java.text.SimpleDateFormat;
  31. import java.util.Calendar;
  32. import java.util.Formatter;
  33.  
  34.  
  35. public class fileTimeLog
  36. {
  37. File log = new File("log/sixWeek.dat");
  38. File folder = new File("log");
  39. PrintWriter logW = new PrintWriter("log/sixWeek.dat");
  40.  
  41. public fileTimeLog() throws IOException
  42. {
  43. System.out.println("successful");
  44. checkFile();
  45. }
  46.  
  47. public void checkFile() throws IOException
  48. {
  49. if(!(log.exists()))
  50. {
  51. createFile();
  52.  
  53. }
  54. }
  55. public void saveTime() throws IOException
  56. {
  57.  
  58. }
  59.  
  60. public void saveDate()
  61. {
  62.  
  63. }
  64.  
  65. public void createFile() throws IOException
  66. {
  67. folder.mkdir();
  68. logW = new PrintWriter(log);
  69. logW.println("DONT MODIFY THIS FILE IF UNLESS YOU KNOW WHAT YOUR ARE DOING ");
  70. logW.close();
  71.  
  72. }
  73.  
  74. }
  75.  
  76. Exception in thread "main" java.io.FileNotFoundException: logsixWeek.dat (The system cannot find the path specified)
  77. at java.io.FileOutputStream.open0(Native Method)
  78. at java.io.FileOutputStream.open(FileOutputStream.java:270)
  79. at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
  80. at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
  81. at java.io.PrintWriter.<init>(PrintWriter.java:184)
  82. at fileTimeLog.<init>(fileTimeLog.java:17)
  83. at main.main(main.java:18)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement