943,083 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 5105
  • Java RSS
Aug 21st, 2008
0

Cannot Find File Exception

Expand Post »
Okay im working on this game and all the code was in JSE 1.2 i just updated to that new package with the NetBeans IDE 5.0 and wh atnot inside it which is very nifty actually problem is all of my code when put into project files wont find any files, i tried moving the file folders into the class compiled folder, and the dist folders so that they would be in the same folder still i get this

Java Syntax (Toggle Plain Text)
  1. java.io.FileNotFoundException: ..\log\server.log (The system cannot find the path specified)
  2.  
  3. at java.io.FileOutputStream.open(Native Method)
  4.  
  5. at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
  6.  
  7. at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
  8.  
  9. at DSpiresServer.startServer(DSpiresServer.java:200)
  10.  
  11. at DSpiresServer.run(DSpiresServer.java:123)

the code referenced is this
Java Syntax (Toggle Plain Text)
  1. // Cycle error log save
  2. for (int i=savelog-1;i>0;i--) {
  3. afile=new File("../log/error.log_"+i);
  4. if (afile.exists()) {
  5. bfile=new File("../log/error.log_"+(i+1));
  6. afile.renameTo(bfile);
  7. }
  8. }
  9. afile=new File("../log/error.log");
  10. bfile=new File("../log/error.log_1");
  11. afile.renameTo(bfile);
  12.  
  13. FileOutputStream fos = new FileOutputStream(new File("../log/server.log"));
  14. FileOutputStream fos2 = new FileOutputStream(new File("../log/error.log"));
  15. if (LOG_COMMANDS)
  16. commandLog = new PrintStream(new FileOutputStream(new File("..../log/commands.log")));
  17. System.setErr(new PrintStream(fos2));
  18. System.setOut(new PrintStream(fos));
  19. }
  20. catch (IOException e) {
  21. e.printStackTrace();
  22. }

could anyone please give me a little help with this i am not familiar with Java and i am trying to learn this as i go its a new language for me and i really could use help you can email me or reply here at <<email snipped>>
Last edited by ~s.o.s~; Aug 22nd, 2008 at 5:18 am. Reason: Keep it on site. Added code tags, learn to use them.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
algorion is offline Offline
4 posts
since Aug 2008
Aug 21st, 2008
0

Re: Cannot Find File Exception

1. don't ask for emails.
2. use code tags for code

FileWriter
why are you changing using rename on a file you are writing, what is this code's purpose?
Reputation Points: 73
Solved Threads: 22
Posting Pro in Training
sciwizeh is offline Offline
423 posts
since Jun 2008
Aug 21st, 2008
0

Re: Cannot Find File Exception

its just suposed to update my log file every so often on my server
Reputation Points: 10
Solved Threads: 0
Newbie Poster
algorion is offline Offline
4 posts
since Aug 2008
Aug 21st, 2008
0

Re: Cannot Find File Exception

when one file exist it saves it with server.log1-2-3-4-ect so there are not massive big files
Reputation Points: 10
Solved Threads: 0
Newbie Poster
algorion is offline Offline
4 posts
since Aug 2008
Aug 22nd, 2008
0

Re: Cannot Find File Exception

I would suggest to look at this class: Logger

And search tutorials or examples, since you are interesting in log files
Sponsor
Featured Poster
Reputation Points: 1005
Solved Threads: 446
Nearly a Senior Poster
javaAddict is offline Offline
3,256 posts
since Dec 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Please help me to print this triangle shape using Java loops
Next Thread in Java Forum Timeline: java platform game





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC