Reputation: 21
Java EE. Maven.
Package resources
marked as Resource root
, package java as Source root
also.
In my class I have path String property\file.properties
, but when I run it, IDEA
throws an exception :
"java.io.FileNotFoundException: property\file.properties (The system cannot find the path specified)"
But when I change path String to src\main\resources\property\file.properties
it works.
Packages marked as source. In Project File - Module I also see that this directories marked as source roots.
How can I fix it, any ideas?
I have already tried invalidate cache.
P.S: When I rename my string path with shift + f6
file also change name.
EDIT: Source root packages
Upvotes: 2
Views: 9917
Reputation: 6710
In IntelliJ IDEA Ultimate as whereas the Community Edition, you can mark any folder in your project as your Sources, Tests, Resources, etc directory.
Right-click on your project root directory ➡ Select Open Module Settings in the context menu.
In the Project Structure window that opens, choose a folder in your project ➡ then select to 'Mark' that folder as your Sources or Resources directory depending on your needs.
You should see a list of marked folders in the right pane of the same window. Click the Apply and OK button when done to save your new changes.
Upvotes: 2