Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4624926
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:11:58+00:00 2026-05-22T03:11:58+00:00

Java applet code package M257Applet import java.applet.*; import javax.swing.*; import java.awt.*; public class HellowApplet

  • 0

Java applet code

package M257Applet

import java.applet.*;

import javax.swing.*;

import java.awt.*;

public class HellowApplet extends JApplet {

    public  void init(){

        Container cp = getContentPane();
        JLabel lb = new JLabel("Hellowwwww");
        cp.add(lb);
    }

}

html file

<html>
<head>
<title>Applet</title>
</head>
<body>
<APPLET CODE = HellowApplet.class  WIDTH =  400   HEIGHT = 400 >
</APPLET>
</body>
</html>

Error

Java Plug-in 1.6.0_22
Using JRE version 1.6.0_22-b04 Java HotSpot(TM) Client VM
User home directory = C:\Users\pc
----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------


java.lang.NoClassDefFoundError: HellowApplet (wrong name: M257Applet/HellowApplet)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Exception: java.lang.NoClassDefFoundError: HellowApplet (wrong name: M257Applet/HellowApplet)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:11:58+00:00Added an answer on May 22, 2026 at 3:11 am

    Problem is with the package. You need to change the code attribute of applet, and based on where you have placed your HTML, the codebase attribute too. You have to place HellowApplet.class in a directory called M257Applet (because that is the package you have given), and the applet tag should look something like:

    <applet code="M257Applet.HellowApplet" ... ></applet>
    

    For this to work, your HTML has to be in the same directory as M257Applet (not inside M257Applet). Alternatively, you can specify the codebase attribute. For eg, with the following directory structure:

    somedir
      +-- hello.html
      +-- M257Applet
      |    +-- HellowApplet.class
    

    the applet will work. If however, you had

    anotherdir
      +-- hello.html
      +-- somedir
      |   +-- M257Applet
      |   |    +-- HellowApplet.class
    

    then you will have to specify codebase attribute like so:

    <applet code="M257Applet.HellowApplet" codebase="somedir" ... ></applet>
    

    So, you should have codebase pointing to the directory containing your package, and code has to have your package name also in it.

    Edit:
    Please note, even though code="HellowApplet.class" will work, the correct way of specifying the applet is without the “.class” at the end.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I read that you could call JavaScript code from a Java Applet by calling
We have a Java Applet built using AWT. This applet lets you select pictures
I have a Java Applet that uses AWT. In some (rare) circumstances, the platform
I'm looking around for a Java code signing certificate so my Java applets don't
I made a Java Applet with some Standard GUI Components on it. I used
I've written a Java applet . A user reports that he tried to run
Can a Java Applet able to print out text/html easily to standard printer driver(s)
I'm using firefox3 to run a Java Applet (on Linux). normally, when the JVM
If I'm running a signed Java applet. Can I load additional classes from remote
how can I save a java applet from a website so I can run

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.