Slow loading problem when using new generation Java Applet with Webstart technology
I am using applets through webstart technology, specified by a jnlp. The problem is when applet is loading, in some point it starts to load really slow.
Here is an output of java console when loading, when I say it become slower:
09:10:34.085 [Thread-15] INFO c.g.r.d.ClassPathDataSource - loading stream classpath://assets/images/ball_animation.png
network: Conectando http://acoppes-laptop.local/prototipos/discoverthename-latest/resources-0.0.1-SNAPSHOT.jar con proxy=DIRECT
09:10:34.099 [Thread-15] INFO c.g.r.d.ClassPathDataSource - loading stream classpath://assets/images/block_crack_animation.png
network: Conectando http://acoppes-laptop.local/prototipos/discoverthename-latest/resources-0.0.1-SNAPSHOT.jar con proxy=DIRECT
09:10:34.107 [Thread-15] INFO c.g.r.d.ClassPathDataSource - loading stream classpath://assets/images/block_crack_animation.png
network: Conectando http://acoppes-laptop.local/prototipos/discoverthename-latest/resources-0.0.1-SNAPSHOT.jar con proxy=DIRECT
09:10:34.115 [Thread-15] INFO c.g.r.d.ClassPathDataSource - loading stream classpath://assets/images/block_crack_animation.png
network: Conectando http://acoppes-laptop.local/prototipos/discoverthename-latest/resources-0.0.1-SNAPSHOT.jar con proxy=DIRECT
09:10:34.125 [Thread-15] INFO c.g.r.d.ClassPathDataSource - loading stream classpath://assets/images/block_crack_animation.png
networ开发者_运维技巧k: Conectando http://acoppes-laptop.local/prototipos/discoverthename-latest/resources-0.0.1-SNAPSHOT.jar con proxy=DIRECT
09:10:34.134 [Thread-15] INFO c.g.r.d.ClassPathDataSource - loading stream classpath://assets/images/block_crack_animation.png
network: Conectando http://acoppes-laptop.local/prototipos/discoverthename-latest/resources-0.0.1-SNAPSHOT.jar con proxy=DIRECT
This is an example of how jnlp looks like:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+"
codebase="http://www.gemserk.com/prototipos/discoverthename-release/"
href="launch-applet.jnlp">
<information>
<title>Discover The Name - Ludum Dare 19</title>
<vendor>Gemserk</vendor>
<homepage href="http://www.gemserk.com" />
<description>arielsan's game entry for Ludum Dare 19</description>
<offline-allowed />
</information>
<security>
<all-permissions />
</security>
<resources>
<j2se version="1.6+" />
<jar href="main-0.0.1-SNAPSHOT.jar" />
<jar href="resources-0.0.1-SNAPSHOT.jar" />
<jar href="game-0.0.1-SNAPSHOT.jar" />
<jar href="logback-classic-0.9.17.jar" />
<jar href="logback-core-0.9.17.jar" />
<jar href="slf4j-api-1.5.8.jar" />
<jar href="core-0.0.9-SNAPSHOT.jar" />
<jar href="google-collections-1.0.jar" />
<jar href="commons-io-1.4.jar" />
<jar href="guice-2.0.jar" />
<jar href="aopalliance-1.0.jar" />
<jar href="cglib-2.2.jar" />
<jar href="asm-3.1.jar" />
<jar href="resourcesmanager-core-0.0.9-SNAPSHOT.jar" />
<jar href="commons-0.0.9-SNAPSHOT.jar" />
<jar href="slickmodule-0.0.9-SNAPSHOT.jar" />
<jar href="slick-274.jar" />
<jar href="jnlp-1.2.jar" />
<jar href="lwjgl-2.6.0-GEMSERK.jar" />
<jar href="jinput-2.6.0-GEMSERK.jar" />
<jar href="resourcesmanager-slickmodule-0.0.9-SNAPSHOT.jar" />
<jar href="animation-0.0.2-SNAPSHOT.jar" />
<jar href="vecmath-1.3.1.jar" />
</resources>
<resources os="Windows">
<nativelib href="lwjgl-2.6.0-GEMSERK-natives-win.jar" />
<nativelib href="jinput-2.6.0-GEMSERK-natives-win.jar" />
</resources>
<resources os="Linux">
<nativelib href="lwjgl-2.6.0-GEMSERK-natives-linux.jar" />
<nativelib href="jinput-2.6.0-GEMSERK-natives-linux.jar" />
</resources>
<resources os="Mac OS">
<nativelib href="lwjgl-2.6.0-GEMSERK-natives-mac.jar" />
<nativelib href="jinput-2.6.0-GEMSERK-natives-mac.jar" />
</resources>
<applet-desc name="arielsan's game entry for Ludum Dare 19"
main-class="org.newdawn.slick.AppletGameContainer" width="800" height="600">
<param name="game" value="com.gemserk.games.discoverthename.Game" />
</applet-desc>
</jnlp>
That is a jnlp of my game, it could be tested here.
I have tried different browsers on different machines on different OS, and the problem persist.
The problem seems to be when loading assets from inside a resource, but only happens when loading the applet embedded in the browser, if I call javaws from console, it works without problems.
I have also a another game working great, using the same jnlp template here.
Wow. That's a pretty large download of jars. I know you mentioned it works ok when you run from the console, but in general, you might consider using a combination of JarJar and Pack200 to create a single, highly compressed JAR which should download much faster than separate JAR downloads. The downside is that a single update published to one library will require another full download, which with separate JARs would not be required.
Try turning off the codebase_lookup parameter.
精彩评论