This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Spring and the fly likes Refresh a folder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Refresh a folder" Watch "Refresh a folder" New topic
Author

Refresh a folder

Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Is there a way to refresh a folder or the whole project using Java/Spring. When i do a file upload and want to display the tree list, the file gets uploaded and when i try to display it, the file isn't displaying. But once i refresh the folder manually its just displaying. Please help me guys.


Never try to be a hard-worker. Be a smart-worker.
My Blog
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Where's the tree list/folder/project you want to refresh?

Are you talking about the operating system file explorer? your IDE? an application you've developed?

I assume you're talking about the operating system file explorer - there probably isn't a way to do this through Java... the actual file/directory is being created, it's just the file explorer view that's not updating to show it.

What OS are you using? If I search Google for "Windows file explorer doesn't refresh when new file" most of the top results are for some issues with Windows 7.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Yes, the project file directory is what i want to refresh.
Dir structure is

PRJ1
--WebContent
--WEB-INF
--images
--src
--package root

Now i need to refresh the images folder so that it'll display the uploaded image in the JSP Page. I want to do it programmatic-ally using Java.

Is it possible to do so?
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

There's no way to "refresh" the file system... this is just an artifact of windows explorer. Either a file exists or it doesn't, it's not like you upload/copy/create a file and it doesn't exist until you refresh the directory. How is your JSP getting the file to show?
Justin Brown
Greenhorn

Joined: Aug 18, 2011
Posts: 1
I know this thread is a little old but I had a similar problem and putting Thread.sleep(2000); right after the update fixed the problem.
Geeta Puttappanavar
Ranch Hand

Joined: Jan 18, 2012
Posts: 43
Hi,

I too have the same requirement to upload a file, from which a graph will be generated(garph image will be saved in web content/image folder) and I need to display the image to user.

My problem is that for different files the graphs are generating and everything is working fine locally. But when I try using IP address, the image is not displaying (X mark displaying). When I refresh the image folder then the image is getting displayed.

Thanks in advance,
Geeta
Geeta Puttappanavar
Ranch Hand

Joined: Jan 18, 2012
Posts: 43
Can any of you help me please?
 
jQuery in Action, 2nd edition
 
subject: Refresh a folder