Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am retrieving an image blob form mysql and trying to the store the file in my WebContent/images folder.

When i write this in eclipse
C#
path = "snap.jpg";
           outputStream=new FileOutputStream(path);

It stores it in
D:\ani\eclipse-jee-juno-SR1-win32\eclipse
where as my current working Directory is
F:\workspace\EcWorkSpace\OnlineEduSys
which has all my contents.

when i try to give a relative path images/snap.jpg
java.io.FileNotFoundException: images\snap.jpg (The system cannot find the path specified)
whereas my images folder in my webcontent directory.
i have tried with prefix as / and ./ with the images folder and nothing works.

i have tried it in my webinf folder and it yields the same result.
Kindly help. Thanks in advance.
Posted
Comments
Richard MacCutchan 23-Mar-15 5:22am    
There is obviously some discrepancy between your current directory, and the directory where your program is running from. You should check again.
OniJava 23-Mar-15 8:15am    
Hi Richard, I have checked it many times. When i do getContextPath it is giving me the working directory but when the same path is used to save the image, the Same IOException is appearing.
Richard MacCutchan 23-Mar-15 8:36am    
I can only assume it is some permissions issue in your directories, but as we cannot see exactly what is happening in your code it's impossible to tell. You should add some debug code to your program to try and narrow down the problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900