• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Delete folder on window close

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I want to delete a folder and its contents when I close my application browser. Please let me know how to do it using java.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is application browser? You mean like Firefox, Chrome?
 
nancy andrew
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya any browser explorer, firefox, chrome.. When I click on the X button of the browser (top right side), then one of the folder which I created on my desktop should get deleted
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I doubt if this is possible.
There may be some solution with Javascript or GreaseMonkey, but I doubt if it will work for all scenarios.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are you really trying to accomplish? Because what you are asking is not possible. Not only is there no way to detect when a browser is closed from a page loaded into the browser, without a signed applet, page code has no way to affect or even see the client file system.

Or are you asking about a desktop program monitoring browser instances? It'd help if you'd spend a bit more time explaining your scenario and requirements.
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Something tells me this is a web application that creates a folder on the server for a client. That folder is only relevant while the client is still active on the web application.

As said before there is no way to find out when the browser is closed. But there's something close. HttpSession has a matching listener, HttpSessionListener. You configure the usage of such a listener in the web.xml file. You then use the sessionDestroyed method to be notified when the session is removed. This may be hours after the browser is closed, but it's as close as you're going to get.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic