java: java.io.FileNotFoundException when executing in Eclipse

I once tried to encounter this problem. So I have this setup as,


.├── 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

Popular posts from this blog

Converting sectors into MB - Useful in understanding the sectors in iostat in Linux

What is Disk Contention?

Installing MySQL from source: Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)