This week's book giveaway is in the Features new in Java 9 forum.
We're giving away four copies of Java 9 Revealed and have Kishori Sharan on-line!
See this thread for details.
Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How limit instances of an applet in a JVM  RSS feed

 
Muhammad Sarwar
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I have a senario in which I want the user to lauch only a single instance of my applet on a machine (JVM).Is there any way to prevent an applet being lauched more than once?
thanx in advance
 
Norm Radder
Rancher
Posts: 1772
26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applets normally are run in a browser via the java plugin. Is that how yours is run?
Not sure how you would prevent the client/user from openning another browser window and loading another copy of the HTML page with the applet.

Is there a specific problem that you are trying to solve?
 
Maki Jav
Ranch Hand
Posts: 449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This can be done by using cookies. The page will check for a specific cookie each time it is opened. If the cookie is found, divert it to some other message page otherwise let the page be opened on client.
This cookie is destroyed each time the page is closed.

Hope, this solves your problem!

Maki Jav
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!