Cannot Find File Exception

Reply

Join Date: Aug 2008
Posts: 4
Reputation: algorion is an unknown quantity at this point 
Solved Threads: 0
algorion algorion is offline Offline
Newbie Poster

Cannot Find File Exception

 
0
  #1
Aug 21st, 2008
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

  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
  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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 414
Reputation: sciwizeh is on a distinguished road 
Solved Threads: 22
sciwizeh's Avatar
sciwizeh sciwizeh is offline Offline
Posting Pro in Training

Re: Cannot Find File Exception

 
0
  #2
Aug 21st, 2008
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?
My site, random PM's from people I haven't hear from before will be DELETED
"If people are good only because they fear punishment, and hope for reward, then we are a sorry lot indeed.",
"If we knew what it was we were doing, it would not be called research, would it? "
-Albert Einstein
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 4
Reputation: algorion is an unknown quantity at this point 
Solved Threads: 0
algorion algorion is offline Offline
Newbie Poster

Re: Cannot Find File Exception

 
0
  #3
Aug 21st, 2008
its just suposed to update my log file every so often on my server
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 4
Reputation: algorion is an unknown quantity at this point 
Solved Threads: 0
algorion algorion is offline Offline
Newbie Poster

Re: Cannot Find File Exception

 
0
  #4
Aug 21st, 2008
when one file exist it saves it with server.log1-2-3-4-ect so there are not massive big files
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 1,938
Reputation: javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all javaAddict is a name known to all 
Solved Threads: 252
Featured Poster
javaAddict's Avatar
javaAddict javaAddict is online now Online
Posting Virtuoso

Re: Cannot Find File Exception

 
0
  #5
Aug 22nd, 2008
I would suggest to look at this class: Logger

And search tutorials or examples, since you are interesting in log files
I murdered thousands for the Emperor and he gave me nothing except his damning silence. Now his lapdogs yap for every life I take, while the gods promise me the galaxy.
- Svane Vulfbad -
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 2206 | Replies: 4
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC