Manoj
Manoj

Reputation: 5867

what is absolute file path in windows machine using java?

I am refering file path in two places in my program. In one place, i pass file path in FileInputStream and in another place i pass to Spring getResource() method.

If i give file path in FileInputStream like "file:/C:/myfile" it is throwing error. I had to give C:\\myfile.

But in getResource() method, if i give C:\\myfile it is throwing error i had to give file:/C:/myfile.

Why this difference? Can you please clarify?

Upvotes: 1

Views: 128

Answers (1)

Crazyjavahacking
Crazyjavahacking

Reputation: 9697

FileInputStream is taking a String representing file path. getResource() from Spring is taking URL string representation of the resource.

Those two are not the same.

Upvotes: 2

Related Questions