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

  • SEARCH
  • Home
  • 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 7438589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:34:41+00:00 2026-05-29T10:34:41+00:00

I’ve just started programming with Java, so might appear as silly question, but I

  • 0

I’ve just started programming with Java, so might appear as silly question, but I was not able to find simple answer on the internet. This is “big” question which I have to answer before getting too deep into development, so you can help me to save a lot of time on trying different approaches.

I am currently creating a website using Java. Important feature of this website would be realized through separate Java thread (like daemon) which must be run in background for as long as the user is on the website. At the sametime, website applets must have means of communication with this thread.

I see three potential solutions to this:

  1. Create traditional multipage website with stand-alone java applets in each separate page. I am not sure if it is possible, the following questions arise:

    • is it possible for java thread created by java applet to continue execution after user navigated to another webpage (on the same website)? I assume that yes.
    • is it possible for newly launched java applet to communicate with java thread already running in background? (I’ve seen part of documentation covering communication between java applets through JavaScript, not sure that this can be used in my case. Any other options?)
  2. Create single-page website, with one single java applet, responsible for all navigation and rendering all pages. This solves the problem with background daemon, which becomes easy to implement and communicate with, as part of single applet, but raises one more questions:

    • I know that applet can modify current webpage. Is it feasible to use this feature to simulate navigation between different pages?
  3. Create Java Webstart application, basically by taking the single java applet from p.2 and converting it into stand alone application.

I want the whole thing to have a look and feel of website, so I would prefer option 3 over option 2 and option 1 over option 2.

Thank you for any thoughts you share.

UPDATE:
Does anybody know answers specifically to the two questions under p1? If it is possible to work with java threads the way described?

Now I would most probably opt for making a Java Webstart Application. This should be the least painful way.

UPDATE 2:
I finally decided to work on single java applet, which can be easily converted to JWS application if needed. Nature of my project is that I need to make impression of working with website, that’s why I am putting additional efforts to make it appear as a website. For knowledgeable people it will be obvious, that it is more like a local application.
Solution I chose has following benefits in my situation:
– easily convertable from JWS application to Java applet and back.
– no problems with running background thread and communicating with it.
– more reliable security (meaning that I don’t need to use any mechanisms to pass over session ids from one applet to the other)

Contras:
– if size gets large, start up will be slow – I hope to avoid this.
– Security issues – I tried signing the applet and it helped a lot.
– Work of navigation buttons in browser (back and forth) – I hope to be able to replicated it in applet. Think applet should be able to catch this event.

  • 1 1 Answer
  • 0 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-29T10:34:42+00:00Added an answer on May 29, 2026 at 10:34 am

    Java thread […] which must be run in background for as long as the user is on the website

    If the thread being forked is to preserve state while the client is logged in then I would use a database, memory cache, or some other persistance layer to hold the client session state. This is a much more typical model. You can also have multiple frontends that share session information across the network.

    If you are not talking to a browser then creating a stand-alone web application may be the best choice. You can still use HTTP as your transfer protocol in which case I’d recommend using a Java web implementation like Jetty. This would involve significantly less technology and complexity.

    If you need to implement web pages, I would certainly use proper frontend models and technology. You should separate your pages into multiple applets — or multiple controllers/views in the MVC model. Using the applets should be fine. They (or the controllers) should call a centralized service which starts, communicates with, and stops the background threads depending on the information flow.

    I would also certainly have another background thread running to time out your client threads in case a client never returns. Your worker threads could just exit after a certain amount of waiting.

    Hope this helps.


    is it possible for java thread created by java applet to continue execution after user navigated to another webpage (on the same website)? I assume that yes.

    Yes. Threads that are forked will continue to run until they terminate or (if daemon) the process terminates.

    is it possible for newly launched java applet to communicate with java thread already running in background?

    Sure. What they need is some mechanism to be able to share data. For example, your background thread service could keep a Map of the thread objects with the key being some sort of client-id. Whenever a thread wanted to talk to it’s background thread then it could call the service to lookup the thread by id. Something like:

    BackgroundStream thread = threadService.getThread(clientId);
    thread.callMethod(...);
    

    If there was some sort of synchronous question/response then you’d need to have a condition variable or something. Read up on Java threads for more information.

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

Sidebar

Related Questions

Seemingly simple, but I cannot find anything relevant on the web. What is the
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I

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.