Loading a simple Hello World Applet faster?

I'm new to java. I;m trying to load the hello world applet but the problem is that it takes about 20 to 30 seconds to load at first attempt, I there a way to make this faster, i have tryed making a jar file and running that but nothing changes in speed.
[261 byte] By [jkhoaa] at [2007-11-26 12:40:23]
# 1
That might be less the applet loading time than the time to load the whole JVM.Making a jar file reduces loading time if you have a lot of separate files associated with the applet. For a one-class-file hello-world applet it would probably only slow things down.
paulcwa at 2007-7-7 16:11:49 > top of Java-index,Java Essentials,New To Java...
# 2

You'll have to supply more specific information for any valid answer. Where is the applet located, in your machine or on another machine? If another, what's the connection? How much memory? CPU speed? etc.

Write a HelloWorld program (not applet) and run it from your commandline. How quick is that?

ChuckBinga at 2007-7-7 16:11:49 > top of Java-index,Java Essentials,New To Java...
# 3
well the hello world application works really fast but when i make an applet and put the applet tag into an html file along with the class file onto a hosting server (yahoo geocities) it takes a long time to load. I;m sure it's not my computers speed problem because I have 3.3 Ghz
jkhoaa at 2007-7-7 16:11:49 > top of Java-index,Java Essentials,New To Java...
# 4

Well, it's always going to be slower to run the applet in a web page in a browser because you have the extra steps of the browser grabbing the files over the network, parsing the HTML fully, displaying the page, and starting the JVM. The appletviewer grabs the files locally, does a simpler parse of the HTML, doesn't have to display much HTML, and already is a JVM.

In my experience, JVMs inside of browsers (the early days) were significantly slower than a JVM you invoked on the command line. Now that there's the plug-in, it's still slower but not by much.

What browser are you using? Are you using a modern browser and the Java plug-in or are you using, say, and old browser with the JVM built in?

Also, how long does it take to download the HTML and the class file from the server? What happens when you download them directly with something like wget or curl?

paulcwa at 2007-7-7 16:11:49 > top of Java-index,Java Essentials,New To Java...
# 5
I'm using firefox, i'm not sure though what plug-in i have, but firefox or IE or netscape, it still takes about 20-30 sec to load the first time, but after that the time it takes to load when you load it the applet again is about 2-4 seconds
jkhoaa at 2007-7-7 16:11:49 > top of Java-index,Java Essentials,New To Java...
# 6
That sounds like most applets that load over the net. The initial delay is the java startup/communications/download functions.
ChuckBinga at 2007-7-7 16:11:49 > top of Java-index,Java Essentials,New To Java...
# 7

Especially considering we're talking about a free host like Geocities. Generally you're not going to get blazing fast response times from them. Downloading the applet, even if it is small, is going to take some time. The fact that it only happens the first time is evidence enough that it's not the JVM, but downloading and caching the applet for the first time and everything that involves.

kablaira at 2007-7-7 16:11:49 > top of Java-index,Java Essentials,New To Java...
# 8
So, there is not solution to make it any faster.
jkhoaa at 2007-7-7 16:11:49 > top of Java-index,Java Essentials,New To Java...
# 9
> So, there is not solution to make it any faster.Get a better hoster.
CeciNEstPasUnProgrammeura at 2007-7-7 16:11:49 > top of Java-index,Java Essentials,New To Java...
# 10
well is it possible then to have to user download the program once and from then on not need to re-download?
jkhoaa at 2007-7-7 16:11:49 > top of Java-index,Java Essentials,New To Java...
# 11
If the user doesn't restart the browser, I think that's pretty much the default behavior, and would explain the results you got initially.
paulcwa at 2007-7-7 16:11:49 > top of Java-index,Java Essentials,New To Java...