IntelliJ Idea can't find directory

11,520

Okay, I figured out the problem. For some reason, IntelliJ set the working directory to the folder that contains the working directory. Instead of going to /Users/Tyler/Google Drive/Java/Mac Workspace/Game/maps/default.txt like it was supposed to, it was skipping the game folder and going to /Users/Tyler/Google Drive/Java/Mac Workspace/maps/default.txt. To fix this, go to "Run" > "Edit Configurations...", and add on to the field titled "Working Directory."

Share:
11,520
Tyler
Author by

Tyler

Updated on June 04, 2022

Comments

  • Tyler
    Tyler almost 2 years

    So, I recently switched from Eclipse to IntelliJ Idea, but for some reason when I run my java code, it can't find the directory where I store a file that I read in my program. I know that it works in Eclipse and when I export it as a jar file, so why doesn't it work in IntelliJ Idea? The specific error message is java.io.FileNotFoundException: /Users/Tyler/Google Drive/Java/Mac Workspace/maps/default.txt (No such file or directory)

  • kukido
    kukido over 10 years
    That's most likely happened because of some logic in the code. IntelliJ or Java don't just skip folders if not told so.
  • Tyler
    Tyler over 10 years
    Actually, it was how I set up the project folder, since it's different from eclipse, but I didn't know that. The coding is fine.