3 Replies - 712 Views - Last Post: 23 October 2009 - 06:08 AM Rate Topic: -----

#1 UrbanTwitch  Icon User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 233
  • Joined: 27-September 09

An unexpected error occured.stats.txt (The system cannot find the file

Posted 22 October 2009 - 07:39 PM

Hi guys, I have to turn this game in tomorrow at 3PM.. anyways, I can't figure this for the life of me..

problem MAY be in the bossBattle() method... most likely.
It compiles fine but when I run it... I get this
An unexpected error occured.stats.txt (The system cannot find the file specified
)
An unexpected error occured.stats.txt (The system cannot find the file specified
)
An unexpected error occured.stats.txt (The system cannot find the file specified
)
Exception in thread "main" java.lang.NumberFormatException: For input string: ""

		at java.lang.NumberFormatException.forInputString(NumberFormatException.
java:48)
		at java.lang.Integer.parseInt(Integer.java:468)
		at java.lang.Integer.parseInt(Integer.java:497)
		at game.bossBattle(game.java:590)
		at game.main(game.java:253)
Press any key to continue . . .


Here is code..
http://www.javadan.p...n.com/m5e11b719

This post has been edited by UrbanTwitch: 23 October 2009 - 06:11 AM


Is This A Good Question/Topic? 0
  • +

Replies To: An unexpected error occured.stats.txt (The system cannot find the file

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4361
  • View blog
  • Posts: 12,179
  • Joined: 18-April 07

Re: An unexpected error occured.stats.txt (The system cannot find the file

Posted 22 October 2009 - 07:50 PM

Well the errors tell you, you are trying to open or do something with stats.txt and it doesn't exist or it cannot be found. Make sure that stats.txt is in the same place as your .java file. Secondly, you didn't post bossBattle's code. If the problem is there, we can't see the function to tell you if it is. If you need to trouble shoot this, you can also put your stats.txt file in a well known directory and then change all your places where you reference it to that hardcoded path. Like put it in the c:\ root drive and then chance all your paths to c:\\stats.txt or something to make sure it is found.

But it would help if you actually showed us the bossBattle function. ;)
Was This Post Helpful? 0
  • +
  • -

#3 painkiller102  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 16
  • View blog
  • Posts: 281
  • Joined: 27-February 08

Re: An unexpected error occured.stats.txt (The system cannot find the file

Posted 22 October 2009 - 07:50 PM

First thing, make sure your file is where you say it is. I would get the target, and put it in IE: "C:\test\test.txt" and try again. If it still doesn't work, make sure the file contains what its supposed to and you have a problem when saving "gold" or something. You need to include:
[code]
out.close();
out.flush();
[code]

that way it will actually save what you write to the file.
Was This Post Helpful? 0
  • +
  • -

#4 UrbanTwitch  Icon User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 233
  • Joined: 27-September 09

Re: An unexpected error occured.stats.txt (The system cannot find the file

Posted 23 October 2009 - 06:08 AM

The reason bossBattle() didn't show was becuase it was cut off. :\

Dang.

code:
http://www.javadan.p...n.com/m5e11b719

FIXED IT! :D
IT was because in the main method... I had
bossBattle();
//doMain();
//showIntro();

and bossBattle(); wasn't checking for stats.txt file so it ran regardlessly and thats why it showed that error.

Woo, thanks guys.

This post has been edited by UrbanTwitch: 23 October 2009 - 06:18 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1