This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Multiple javaw.exe instances created while creating swing components

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am trying to create new swing components like Jcalendar of my
own and when i try to create a sample application which is using that
swing component, when i try to run that sample application multiple
instances of javaw.exe are being created and the system gets hanged.

Why is this happening and how to solve this? Kindly help me ASAP.

Thanks,
Smitha
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Smitha!
It should not create multiple instances of java.exe. could you through some code over here to understand what you have done excatly. I think you are doing some simple mistake in your code itself.

Regards,
Saaaaaaachin!!!
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Smitha, you have to either:

1) myjframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

or

2) add a window listener to the frame and System.exit on window close.

If you do not do this the java/javaw process will never terminate.
 
Smitha Bhat
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Please find the sample code. The sample code uses the swing component which i have created. After adding the last line the javaw instances are being closed. But whether its necessary that everytime i run this code the javaw.exe instance should be created. This is my doubt.

Sample Code:

JFrame frame = new JFrame("FileUpload Demo");

//Instantiating my own swing component
FileUploadDemo app = new FileUploadDemo();


Component cont = app.createComponent();
frame.getContentPane().add(cont, BorderLayout.CENTER);


frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);

//Added after your comment - Its working
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!