Eclipse and packaging jPCT with an applet

Started by Dan MacDonald, December 14, 2004, 06:15:15 AM

Previous topic - Next topic

Dan MacDonald

I realize this is slightly newbish, I just discovered jPCT and am pretty excited about making an applet based game with it. I also decided that it would be nice to learn eclipse at the same time. I've been able to get everything to run in eclipse by putting the jpct.jar in my workspace folder. However when I package up the applet in a jar using the "File/Export..." command, I'm having problems getting JPTC included properly. When I run the applet it fails, presumably because it's not linking to the JPTC classes (I can get a basic applet that doesn't use JPTC working just fine). Is there any special trick to this?

Dan MacDonald

So I figured out how to get the com/treed/jpct/* includes in the jar using ANT, I'd still like to know how to do it from eclipse though, if anyone knows the special secret to getting the "com" folder to bundle up in the jar.

oNyx

Hey Dan :)

Well, there isn't such a thing like linking in Java.

Ok there are two ways to do it:

-pack everything into one jar

or

-just do it like you're doing it right now and just specify the other (jpct) jar in the applet tag like:

ARCHIVE   = "game.jar, jpct.jar"

Dan MacDonald

Hello oNyx, nice to see a familiar face.

After looking at a number of the projects that are using jPct I have gotten greedy, I want to know how people are loading the class files dynamically. I've seen a  number of applets start with what appears to be a stub applet with a progress bar saying "loading..." as they load the various dependencies.  Are they loading jar's from the applet base dynamically?

I suspect they are, I'm going to have to look into that later... :)

rolz

Applet packaging and preloading is a very delicate matter.

Generic browsers store downloaded applets in browser cache. Once downloaded, the applet uses locally cached jars - this greatly reduces bandwidth consumption and startup time.

The general "progress bar" is a small applet which preloads all necessary jars for  the main applet. When all jars are loaded into browsers cache, the main applet starts up. Note that generic browser (i dont mean IE) does not cache resources loaded by applet itself. You still have to use javascript or some hidden frame to preload jars.

the current public technopolies version http://213.232.242.32/technopolies uses this approach to load necessary libraries at startup, but the upcoming version will load necessary jars at runtime.
Regards,
Andrei