Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (426)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Applet upgrade procedure  (Read 1641 times)
0 Members and 1 Guest are viewing this topic.
Offline MonsterOfCookie

Junior Member


Medals: 2


Gar


« Posted 2011-03-08 00:42:29 »

Hey All.

Quick question with regarding applet binary upgrades.

If I want to release a new version of my applet, I assume it is best to release it with the jar name containing the version number to force the JRE to pull it down and ignore the other. Is this correct? Is there a way I can tell the JRE to invalidate the previous build and use the new one without having the user to change and local settings?

If this is possible, what are the knock on effects, if any, with regards to the classloader in currently running JRE? (if they are viewing the applet currently and refresh the page)

Cheers

James

Offline ra4king

JGO Kernel


Medals: 322
Projects: 2
Exp: 4 years


I'm the King!


« Reply #1 - Posted 2011-03-08 05:08:12 »

If your applet is running and you upload a new version, to upgrade you have to end the java.exe process and refresh the page. If you want to force using the new version without restarting Java, I think changing the name of the jar file and linking to that one in the HTML file will force it to pull the new one.

Hope that helps Grin

Online Riven
Showcase Moderator

JGO Overlord


Medals: 610
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #2 - Posted 2011-03-08 09:11:36 »

Open the Java Console, hit X and C: it will clear the classloader and clear the console.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline MonsterOfCookie

Junior Member


Medals: 2


Gar


« Reply #3 - Posted 2011-03-08 10:21:30 »

Thanks ra4king that's what I thought was going to be the case. Off the top of your head when they refresh the page would this cause a separate java process to spin up?

Riven, thanks for your input, but that requires input from the end user. I really don't want them to go through a potential 4 step procedure when I update.

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11


Game Engineer


« Reply #4 - Posted 2011-03-08 19:34:50 »

Thanks ra4king that's what I thought was going to be the case. Off the top of your head when they refresh the page would this cause a separate java process to spin up?

Riven, thanks for your input, but that requires input from the end user. I really don't want them to go through a potential 4 step procedure when I update.
When you refresh the page, the previous java process will stop and a new one will start. Depending on their browser settings, they may or may not cache the old version of the applet, meaning they wouldn't get the new one. In order to avoid this, you can do just what you asked - rename each successive update.

See my work:
OTC Software
Offline ra4king

JGO Kernel


Medals: 322
Projects: 2
Exp: 4 years


I'm the King!


« Reply #5 - Posted 2011-03-08 20:07:04 »

Thanks ra4king that's what I thought was going to be the case. Off the top of your head when they refresh the page would this cause a separate java process to spin up?

Riven, thanks for your input, but that requires input from the end user. I really don't want them to go through a potential 4 step procedure when I update.
When you refresh the page, the previous java process will stop and a new one will start. Depending on their browser settings, they may or may not cache the old version of the applet, meaning they wouldn't get the new one. In order to avoid this, you can do just what you asked - rename each successive update.
The Java process does not stop when you refresh a page. If you close the tab, it will take a couple minutes until the Java process closes.
I never knew about the 'X' function in the console so Riven's suggestion is the best.

Offline MonsterOfCookie

Junior Member


Medals: 2


Gar


« Reply #6 - Posted 2011-03-08 20:14:29 »

From a development perspective yes Rivens way is perfectly useful. But I am thinking along the lines of a live environment, I really don't want my players to have to open up the Java console every time I deploy.

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11


Game Engineer


« Reply #7 - Posted 2011-03-08 20:18:46 »

The process stops for me unless the applet is doing something stupid. Even if it sometimes takes a second or two, I think you can consider this working for your purposes.

See my work:
OTC Software
Online Riven
Showcase Moderator

JGO Overlord


Medals: 610
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #8 - Posted 2011-03-08 21:33:22 »

The process stops for me unless the applet is doing something stupid. Even if it sometimes takes a second or two, I think you can consider this working for your purposes.
As been said: it is normal behaviour for the JRE to linger around for minutes, even if the applets do a clean shutdown. Reloading an applet is horrible as you load it in the same classloader and all static fields will still be there. You really must ensure your applet is running isolated, for example by adding random/timestamp parameters to your jars: stuff.jar?rndm=.... (generate this either clientside or serverside).

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline ddyer

Junior Member


Medals: 2



« Reply #9 - Posted 2011-03-09 03:36:18 »

the best procedure is to upload a completely new java hierarchy, then change the HTML
page that loads it to point to the new jar file.  Browser caching is a real problem.  You
cannot depend on the old applet becoming extinct in any particular timeframe.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ra4king

JGO Kernel


Medals: 322
Projects: 2
Exp: 4 years


I'm the King!


« Reply #10 - Posted 2011-03-09 03:48:24 »

the best procedure is to upload a completely new java hierarchy, then change the HTML
page that loads it to point to the new jar file.  Browser caching is a real problem.  You
cannot depend on the old applet becoming extinct in any particular timeframe.
New Java hierarchy?
All you need is a different jar file name.

Offline ddyer

Junior Member


Medals: 2



« Reply #11 - Posted 2011-03-09 06:05:02 »

the best procedure is to upload a completely new java hierarchy, then change the HTML
page that loads it to point to the new jar file.  Browser caching is a real problem.  You
cannot depend on the old applet becoming extinct in any particular timeframe.
New Java hierarchy?
All you need is a different jar file name.
Sure, if your whole applet is in one jar.  Boardspace has about 40.
Offline ra4king

JGO Kernel


Medals: 322
Projects: 2
Exp: 4 years


I'm the King!


« Reply #12 - Posted 2011-03-09 07:58:51 »

40? Overkill much? Grin

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11


Game Engineer


« Reply #13 - Posted 2011-03-09 18:15:04 »

40? Overkill much? Grin
Well you have the advantage of making load times a lot less when you update individual pieces.

A model I have implemented but never used basically has one JAR for code, one for the initial data bundle (sounds and images), and then a new data bundle JAR every time I release an update. Having the user reload the code JAR every time is no problem at all, and being able to just load a new bundle each time really helps with download time. The only real trick you need is if you have AssetA.jpg in bundle 1 and also in bundle 5, you need to make sure to use the one in bundle 5 as that's more recent.

See my work:
OTC Software
Online Riven
Showcase Moderator

JGO Overlord


Medals: 610
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #14 - Posted 2011-03-09 19:04:24 »

The only real trick you need is if you have AssetA.jpg in bundle 1 and also in bundle 5, you need to make sure to use the one in bundle 5 as that's more recent.
Which can be achieved by ordering the jars in the classpath.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Mike

JGO Ninja


Medals: 69
Projects: 1
Exp: 5 years


Java guru wanabee


« Reply #15 - Posted 2011-03-09 19:59:19 »

If you have access to php on the server it's also a good idea to call the jar with something like:

applet.jar?version=<?php echo filemtime("applet.jar"); ?>

It'll append the last modified date to the jar and it therefore won't be cached longer than necessary. That saves you having to manually rename the applet/applet tag every time...

Mike

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline ddyer

Junior Member


Medals: 2



« Reply #16 - Posted 2011-03-09 21:47:50 »

40? Overkill much? Grin
That's one per game plus a few that run the common parts of the site.   It minimizes the user's waiting time if they only have to download the games they actually play.
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11


Game Engineer


« Reply #17 - Posted 2011-03-10 23:53:42 »

The only real trick you need is if you have AssetA.jpg in bundle 1 and also in bundle 5, you need to make sure to use the one in bundle 5 as that's more recent.
Which can be achieved by ordering the jars in the classpath.
Oh, that's cool. I didn't know it was able to do that. I assume the lastmost jars in the classpath are the ones it will use?

See my work:
OTC Software
Online Riven
Showcase Moderator

JGO Overlord


Medals: 610
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #18 - Posted 2011-03-10 23:56:23 »

The only real trick you need is if you have AssetA.jpg in bundle 1 and also in bundle 5, you need to make sure to use the one in bundle 5 as that's more recent.
Which can be achieved by ordering the jars in the classpath.
Oh, that's cool. I didn't know it was able to do that. I assume the lastmost jars in the classpath are the ones it will use?
The first. Smiley

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (72 views)
2014-04-15 18:08:23

BurntPizza (68 views)
2014-04-15 03:46:01

UprightPath (79 views)
2014-04-14 17:39:50

UprightPath (65 views)
2014-04-14 17:35:47

Porlus (80 views)
2014-04-14 15:48:38

tom_mai78101 (104 views)
2014-04-10 04:04:31

BurntPizza (164 views)
2014-04-08 23:06:04

tom_mai78101 (260 views)
2014-04-05 13:34:39

trollwarrior1 (210 views)
2014-04-04 12:06:45

CJLetsGame (220 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!