i want to restart my java swing application when user click on restart button.
how to do it using java.

Recommended Answers

All 4 Replies

Assuming you haven't relied on static variables you can just dispose() your window(s) and create new ones by re-executing the existing startup code

thankx i did that,but i want to know can we restart the application instead of just disopsing window using java.

what do you mean 're-starting'? I assume you won't be actually killing your process in an attempt to do so ...

re-initialize all your variables to your defaults, re-set all your inputfields, and go back to the original screen.

Member Avatar for hfx642

When you press the reset button... you would have to create something which will start your application (possibly in a scheduler job of some sort... maybe 2 or 3 seconds later, giving your application enough time to terminate), then exit your application.
When your application restarts, it should test to see if there is a scheduler job, then kill the scheduler job.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.