• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

i changed a folder name and now my program wont run

 
charlie mills
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I changed the name of a folder so that it would meet the requirements for my assignment submission and now my program wont run in the command window. its saying it can't find the .txt files.
However, the program runs without any problems in JCreator.

i have a folder called Ass_5 with 3 folders in it - src, files and classes as well as build.bat and run.bat. src has the two .txt files, a class file and the java source file. the other two folders are empty. everything is in the right place isnt it?
 
Mark Vedder
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

1. What error message are you getting? Knowing that can help us determine your problem.

2. Which directory did you rename?

3. I assume you are running your program using the run.bat file. Does a it reference the old directory and therefore need to be updated?
 
charlie mills
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. the error is saying java.io.FileNotFoundException: Cities.txt (The system cannot find the file specified)

Its saying that for the Temperatures.txt file as well

2. i renamed the Ass_5 directory. It was called CitiesAndTempsApp before that I think.

3. not sure what you mean. in the command prompt window i typed in build and then run CitiesAndTemperatures
 
Mark Vedder
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So it sounds like the program is running. It is just that it throws an exception that it cannot find your Cities.txt file while it is running.

How are you trying to load that Cities.txt file in your code? Can you post the snippet of the code you are using to load the Cities.txt file? Is that code using a hard coded file path that has your old directory name?
 
charlie mills
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


yeah it does run fine, it just wont find the .txt files
 
Mark Vedder
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
charlie mills wrote:

yeah it does run fine, it just wont find the .txt files

Not to nit pick too much, but in programming, detail and precision are very important. So your subject of "...my program won't run" is very different than what is actually happening which is that your program is failing. ;) It's just that that difference makes a huge difference in how to go about troubleshooting the problem. See the Tell The Details FAQ for more info.

Based on the code you have, it is going to look for the txt files in whatever directory the program is started from (unless the user.dir system property is getting set on the command line).

1. Are in the Ass_5 directory when you issue the run command? If not, try changing into that directory and see if it works.

2. I take it that the run.bat file was provided to you by your teacher? Or did you write it?

I have to run to a meeting, so my next reply will be delayed. But someone else might be able to jump in and pick things up to help you.



 
charlie mills
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am in the Ass_5 directory when i build and run. it automatically starts in projects and i filter down by using cd Ass_5.
yeah, my teacher did give me the run.bat
 
charlie mills
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i've worked out where i've gone wrong now. JCreator was running the classes from the src directory and not the classes directory. i copied the .txt files across to the classes directory and its all working perfectly now.

thanks for your help
 
Mark Vedder
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great. I'm glad you got it working. And I was glad to help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic