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.io.FileNotFoundException: ..\log\server.log (The system cannot find the path specified)

        at java.io.FileOutputStream.open(Native Method)

        at java.io.FileOutputStream.<init>(FileOutputStream.java:179)

        at java.io.FileOutputStream.<init>(FileOutputStream.java:131)

        at DSpiresServer.startServer(DSpiresServer.java:200)

        at DSpiresServer.run(DSpiresServer.java:123)

the code referenced is this

// Cycle error log save
			for (int i=savelog-1;i>0;i--) {
				afile=new File("../log/error.log_"+i);
				if (afile.exists()) {
					bfile=new File("../log/error.log_"+(i+1));
					afile.renameTo(bfile);
				}
			}
			afile=new File("../log/error.log");
			bfile=new File("../log/error.log_1");
			afile.renameTo(bfile);

			FileOutputStream fos = new FileOutputStream(new File("../log/server.log"));
			FileOutputStream fos2 = new FileOutputStream(new File("../log/error.log"));
			if (LOG_COMMANDS)
				commandLog = new PrintStream(new FileOutputStream(new File("..../log/commands.log")));
			System.setErr(new PrintStream(fos2));
			System.setOut(new PrintStream(fos));
		}
		catch (IOException e) {
			e.printStackTrace();
		}

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>>

Recommended Answers

All 4 Replies

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?

its just suposed to update my log file every so often on my server

when one file exist it saves it with server.log1-2-3-4-ect so there are not massive big files

I would suggest to look at this class: Logger

And search tutorials or examples, since you are interesting in log files

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.