Reputation: 645
Can property files have any file extension, like .txt
? Or will they only work properly with .properties
? Can I use a custom file extension, like .foo
?
Upvotes: 3
Views: 480
Reputation: 75406
Yes, you can give property files any name.
The benefit of using a recognized file type is that humans and computers have an idea of the contents will be without looking at the actual content.
Upvotes: 6
Reputation: 136082
Property files are loaded into Properties object with Properties.load(InputStream inStream) method. We can to pass any stream of bytes to this method from any file or other source. Of course those bytes should represent valid properties data.
Upvotes: 1
Reputation: 4202
It can have any extension, extension doesn't matter. But then it becomes difficult to identify the file. Many OS recognize the type of file based on its extension so its better to stick to it.
Upvotes: 1