I've designed a simple applet that works fine on My Windows Xp but when I upload it on my webhost server or run it through any server for e.g. Tomcat It shows the following error in Java Console but no error without server

Java Plug-in 1.6.0_02
Using JRE version 1.6.0_02 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Administrator


----------------------------------------------------
----------------------------------------------------

APPLET tag missing CODE parameter.
java.lang.NullPointerException: name
at sun.applet.AppletClassLoader.getResourceAsStream(Unknown Source)
at sun.applet.AppletPanel$7.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
APPLET tag missing CODE parameter.
java.lang.NullPointerException: name
at sun.applet.AppletClassLoader.getResourceAsStream(Unknown Source)
at sun.applet.AppletPanel$7.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

I don't understand what code parameter is missing

My html code for it is
<APPLET> code="chat.class" width=650
height=600></APPLET>


Dani AI

Generated

A common pattern when an applet runs locally but fails only when served is that the final HTML delivered to the browser is different from the developer’s source. This can happen when a servlet or template engine alters or escapes markup, when filenames or package paths differ on the server (case sensitivity), or when the class/JAR is not reachable from the webroot. This note expands on the thread: it builds on the markup point raised by and the syntax reminder from , and addresses gaps around server-side generation, file accessibility, and packaging.

Typical checks and diagnostics that isolate the problem:

  • Save and inspect the exact HTML returned by the server (View Source). Verify the applet-related element and its attributes exist in the served page exactly as expected.
  • Request the class or JAR directly from the server URL to confirm a 200 response and correct file size; server error or 404 entries show up in access/error logs.
  • Consider filename and package case: Windows is forgiving, many hosts are not. The class name and path must match the deployed filenames exactly.
  • If the servlet prints HTML, confirm no accidental escaping, truncation, or string concatenation errors are occurring; compare with a static test page to separate servlet logic from deployment issues.
  • Enable client-side Java logging (Java Console) and check the server logs for plugin requests; these show what the runtime tried to fetch.

Deployment and long-term notes: packaging classes into a JAR typically simplifies deployment (fewer direct .class requests), but the archive layout must match the package paths. Applets are also deprecated in modern browsers and may be blocked; for lasting compatibility consider alternatives such as a Java Web Start/JNLP approach or moving functionality to a server-backed web UI.

Recommended Answers

All 6 Replies

You closed your applet tag before your parameters. Basically it's malformed HTML that is causing your problem.

<APPLET[B]>[/B]  code="chat.class" width=650 
height=600></APPLET>

Side note: don't bold your entire message for no reason.

Thnx for ur reply but I didn't get you I don't have any params in my applets

Thnx for ur reply but I didn't get you I don't have any params in my applets

Yes, applets have parameters, like "code". Your tag is not written correctly and I showed you exactly where it was broken.
Using the applet Tag

I tried that The same error persists in magnified form ...Actually I'm embedding the applet in the servlet.....I better try with embed and object tags

The correct applet html code is

<applet code="yourclass.class" height=500 width=500></applet>

Hope it works fine.

Thread is a little old. I doubt they still need help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.