java: java.io.FileNotFoundException when executing in Eclipse
I once tried to encounter this problem. So I have this setup as,
However, I got this exception " java.io.FileNotFoundException " where my file wasn't found. I just realize that in Eclipse, when you run your code as "Run as Java Application", Eclipse, by default, will point to the workspace. To fix that, you can have these options:
1. Place your file in your workspace, but that's not the ideal part
2. Replace your "Run configuration" with the working directory where your file exist or belong. See below,
.├── CatTree.xml├── CatTreeVersion.txt├── GetCategories.java├── README.txt├── config.properties└── request.xml
and part of GetCategories.java, I have a statement there executing
config.load(new FileInputStream(configFileLocation));
However, I got this exception " java.io.FileNotFoundException " where my file wasn't found. I just realize that in Eclipse, when you run your code as "Run as Java Application", Eclipse, by default, will point to the workspace. To fix that, you can have these options:
1. Place your file in your workspace, but that's not the ideal part
2. Replace your "Run configuration" with the working directory where your file exist or belong. See below,
Comments
Post a Comment