Results 1 to 3 of 3
  1. #1
    ethical is offline Member
    Join Date
    Apr 2011
    Posts
    3
    Rep Power
    0

    Default Java application get suck when it execute

    I made a application which sends some request packets for web servers and it get stuck when the application is running , until the packets are been sent the programs stays stuck . when the process is done it defreez it self .

    any idea why ??

    Java Code:
        private void reqBtnActionPerformed(java.awt.event.ActionEvent evt) {
          for (i=0; i<10; i++) {
    
            try {
                URL url = new URL(urlTxt.getText()+":80/");
                BufferedReader in = new BufferedReader
                (new InputStreamReader(url.openStream()));
    
                String htmlText;
    
                while ((htmlText = in.readLine()) != null) {
                    resultTxt.setText(resultTxt.getText()+htmlText+"\n");
                }
                in.close();
            } catch (MalformedURLException e) {
                resultTxt.setText(""+e);
            } catch (IOException e) {
                   resultTxt.setText(""+e);
            }
            }
        }

  2. #2
    ethical is offline Member
    Join Date
    Apr 2011
    Posts
    3
    Rep Power
    0

    Default

    Quote Originally Posted by jaambutt View Post
    i need a java application that was installed in the lod siemens mobile phones.
    huh what ?

  3. #3
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,931
    Rep Power
    19

    Default

    Spam, and I'll report it.

    As to your problem, the GUI of a Swing app runs in a thread called the EDT (Event Dispatch Thread). If you do a load of processing in this thread then your GUI will lock up, since it cannot process any events.

    The solution is to launch any long running processes (which is most of them) into their own worker thread using a SwingWorker. See the tutorial for a good run through of this.

Similar Threads

  1. execute a .exe with attributes from java
    By danielleon11 in forum Advanced Java
    Replies: 1
    Last Post: 07-14-2010, 01:25 AM
  2. time to execute a java app
    By svpranay in forum New To Java
    Replies: 6
    Last Post: 06-23-2010, 08:06 AM
  3. Execute InDesign JavaScript from Java Application
    By Vijayasekar in forum New To Java
    Replies: 0
    Last Post: 12-29-2009, 05:13 PM
  4. cannot execute EJB application.
    By JavaEmpires in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 07-17-2008, 09:53 AM
  5. My application Will Not Execute
    By romina in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 05:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •