Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1064073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:52:34+00:00 2026-05-16T18:52:34+00:00

I have a simple applet on a web page like this. (This is a

  • 0

I have a simple applet on a web page like this. (This is a test case cut down from a more complicated applet).

package test;

import java.applet.Applet;

@SuppressWarnings("serial")
public class SimpleLoopApplet extends Applet
{
    public void init()
    {
        System.out.println("SimpleLoopApplet invoked");
        try
        {
            while (true)
            {
                try
                {
                    System.out.println("Sleep for 1 second");
                    Thread.sleep(1000);
                }
                catch (InterruptedException e)
                {
                    System.out.println("Applet thread interrupted while sleeping");
                }
            }
        }
        finally {}
    }
}

On Firefox 3.6.8 on one computer this applet will run for 20 seconds and then exit abruptly, as if the VM is terminating (The java console will disappear; the Java icon will remain in the system tray until I mouse over it; the finally block is never reached).

It’s consistently 20 seconds. 20 “Sleep for 1 second”s printed from the above code, if I extend the sleep to 5 seconds, then 4 messages are printed before termination.

In IE and Chrome on the same computer, the loop will continue on indefinitely, as it will in Firefox 3.6.8 on a different computer.

Can anyone suggest why the applet might terminate in this way?

  • 1 1 Answer
  • 4 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:52:34+00:00Added an answer on May 16, 2026 at 6:52 pm

    From the applet tutorial

    init Method

    The init method is useful for one-time
    initialization that doesn’t take very
    long. The init method typically
    contains the code that you would
    normally put into a constructor. The
    reason applets don’t usually have
    constructors is that they aren’t
    guaranteed to have a full environment
    until their init method is called.
    Keep the init method short so that
    your applet can load quickly.

    start Method

    Every applet that performs tasks after
    initialization (except in direct
    response to user actions) must
    override the start method. The start
    method starts the execution of the
    applet. It is good practice to return
    quickly from the start method. If you
    need to perform computationally
    intensive operations it might be
    better to start a new thread for this
    purpose.

    It looks like you have to create your own thread for long running methods.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to integrate a Java applet into a simple asp.net 2.0 control. This
I have a simple java applet that retrieves an image from a server and
When I have simple drop down box <select id=fruits> <option value=apple>Apple</option> <option value=orange>Orange</option> <option
I have a GWT web-app with a nearly full page Google map window. Inside
I have a fairly simple HTML page with a link on it that calls
I have a need to integrate a third-party Java applet into a custom web
I have a basic web app in place: it has a registration page, a
We have a Java Applet built using AWT. This applet lets you select pictures
I have to make a web-service in Zend Framework for getting data from java
I have an simple array array = [apple, orange, lemon] array2 = [[apple, good

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.