Java question: where to put files so I can compile and run my program from another computer? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Java question: where to put files so I can compile and run my program from another computer?

I have a program that I wrote as a school project that has 5 different txt files. When I compile and run the program I have to (cd) into the program directory before I run the program otherwise I get file not found IO exceptions. How can I avoid this?

17th Jul 2019, 10:02 PM
STEM3586
STEM3586 - avatar
2 Answers
0
I hadn't thought about them being with the class files. When I place them there do I have to specify a specific file location?
17th Jul 2019, 10:25 PM
STEM3586
STEM3586 - avatar
0
Could you give me an example? I've been trying it out on my files but it's still not finding the files when I run the program when outside of the project directory.
18th Jul 2019, 1:52 AM
STEM3586
STEM3586 - avatar