Applets-NoClassDefFound:javax/swing/JApplet

Does the jar,class,HTML files have to be on a server to run on the Web? They now reside
on my C: drive and I get this message when I launch my HTML. Do I load the JAVA plug-in
HTML converter here also? If it is possible to have the Web access the applets on my C: drive
how do I point it to this location?

Hi,
Yes, your jar, class and HTML files need to reside on a server if you want them to be available for the web.
Yes, you'll need to load the Java plug-in HTML converter here also. Normally, it will install only once but the code is required to let the browser know it needs to use another java plugin than the browser's default.
I don't think you can point the applets from the server to your local drive. You can perhaps try to assign a drive letter on the server to your local drive and create a virtual directory pointing to this drive. If this works, the rest should also work (although this is not recommended).
Kurt.

Similar Messages

  • Unable to set classpath javax/swing/japplet in Linux

    Hi,
    I have a problem in running an Applet program in Linux. If I run I get the following message.
    "Javax/swing/JApplet error Java.lang.NoClassDefFound Error".
    I have set my .bash_profile as follows:
    CLASSPATH=/usr/java/jdk1.3_0_01/jre/lib
    CLASSPATH=/usr/java/jdk1.3_0_01/lib
    CLASSPATH=/usr/java/jdk1.3_0_01/
    EXPORT
    Please tell me whether I have created the .bash_profile correctly. or anything to be changed. It will be great help if anybody hep in this regard. I am held up in my project.
    Thnaks.
    Mari
    11/09/02

    You don't need to set the CLASSPATH to get javax.swing.JApplet - the JVM "automagically" knows where the rt.jar file is. The only items you need in your CLASSPATH environment are third-party .jar files.
    I'm taking a wild guess based on your subject line, but I'll bet you mis-typed the ClassName - "JApplet," not "japplet." Your code should have
    import javax.swing.JApplet;in it.

  • NoClassDefFoundError:javax/swing/JApplet  while running japplet in browser

    hai to all,
    i am trying to run a Japplet in broser,
    it's getting NoClassDefFoundError:javax/swing/JApplet
    on statusbar.
    any plugin's are requitred to run swing applets in browser.?please give me details.
    my JApplet is working in Applet viewer.
    i am using Jdk1.3.1, and Applets are also running in my browser(both IE and NetScape).
    thank you in advance
    please mail me to [email protected]
    by
    sambareddy

    I had the same problem when I was developing a swing applet to run on the web. What you have to do is convert your HTML file. It takes out the APPLET tags and replaces them with OBJECT and EMBED tags. This worked for me. I downloaded the converter from the Java site but I cannot recall exactly where. I think if you search for converter you should be able to find it. The newly converted HTML file will also prompt the user to download the correct plug-in if it is not already installed on their machine.
    In the mean time, try using the HTML code below. You will have to change some of the lines but it should work for you. The OBJECT tag is used for IE and the EMBED tag is used for Netscape so don't forget to change both. One wierd thing you will see is that is if you run appletviewer on the converted HTML file, two windows will pop up and one of them will have errors and not load but one will. Don't worry about that, when you run it through the web server, everything works fine.
    Good luck.
    <HTML>
    <HEAD>
    <TITLE>Your title</TITLE>
    </HEAD>
    <BODY>
    <CENTER>
    <!--"CONVERTED_APPLET"-->
    <!-- HTML CONVERTER -->
    <OBJECT classid="clsid:E19F9330-3110-11d4-991C-005004D3B3DB"
    WIDTH = 550 HEIGHT = 300 codebase="http://java.sun.com/products/plugin/1.3.0_01/jinstall-130_01-win32.cab#Version=1,3,0,1">
    <PARAM NAME = CODE VALUE = "the name of your class file" >
    <PARAM NAME = CODEBASE VALUE = "location of the class or jar file">
    <PARAM NAME = ARCHIVE VALUE = "name of your jar file, omit this entire line if you do not have a jar file" >
    <PARAM NAME="type" VALUE="application/x-java-applet;jpi-version=1.3.0_01">
    <PARAM NAME="scriptable" VALUE="false">
    <COMMENT>
    <EMBED WIDTH = 550 HEIGHT = 300 type="application/x-java-applet;jpi-version=1.3.0_01" CODE = "name of your class file" CODEBASE = "location of the class or jar file" ARCHIVE = "name of your jar file, omit this entire arg if you do not have a jar file" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3.0_01/plugin-install.html">
    </EMBED>
    </CENTER>
    </COMMENT>
    </OBJECT>
    <!--
    <APPLET CODE = "name of your class file" ARCHIVE = "name of jar file if you have one" WIDTH = 700 HEIGHT = 400>
    </CENTER>
    </APPLET>
    -->
    <!--"END_CONVERTED_APPLET"-->

  • Problem Loading an Image with javax Swing from a JApplet

    First of all, i use JCreator as java creater and have the newest version of java sdk version.
    Now i need to load an image from the harddrive on which the JApplet is located. I need to do this from inside the JApplet. I have put my pictures in a map 'images' which is located in the same directory as the classes + htm file. It works from inside JCreator, but as soon as i open the normal htm it just WON'T load that image (grmbl).
    Here is my code for loading the image:
    public BufferedImage loadImage (String filename, int transparency)
         Image image;
         if (app)
              image = Toolkit.getDefaultToolkit().getImage(("./images/"+filename));
         else
              String location = "";
              location = "./images/"+filename;
              image = Toolkit.getDefaultToolkit().getImage(location);
         MediaTracker mediaTracker = new MediaTracker(new Container());
         mediaTracker.addImage(image, 0);
         try
              mediaTracker.waitForID(0);
         catch (Exception e)
    Could anybody help me out here??
    I tried a url already using getCodeBase() or getDocumentBase() but that gives an error because it cannot find those if using a JApplet.

    Why don't you use javax.swing.ImageIcon? If you already have a flag telling if it's an application or applet, use the getDocumentBase() to base the URL in the applet part only.

  • Javaclassnotfound javax.swing.JPanel in a applet

    Hi,
    I have a applet which use a class which have the code
    import javax.swing.JPanel;
    public class WebPanel extends JPanel implements Runnable{
    Applet parent;
    i compile it with jdk1.2.2
    my problem is that when i try to run the applet on a Internet Explorer navigator it give me a
    javaclassnotfound javax.swing.JPanel
    problem.
    Javax.swing.JPanel is�nt in IExploter?
    Should i put the javax.swing.Jpanel class in the jar fije?
    Where i can find it?
    Thanks in advance.

    forgot to mention this...get the plug in here:
    http://java.sun.com/products/plugin/
    read the intstructions, u might have to do some 'applet conversion' ....u'll know what I mean when u install the plugin
    good luck

  • Repaint() an applet from a swing applet, why does this code not work?

    below are three files that work as planned except for the call to repaint(). This is envoked when a button is hit in one applet and it should repaint another applet. I opened them up in a html file that simply runs both applets. If you could see why the repaint doesn't work I'd love to know. good luck.
    //speech1
    import java.awt.*;
    import java.applet.Applet;
    import java.awt.event.*;
    //java extension packages
    import javax.swing.*;
    public class speechapp1 extends JApplet implements ActionListener{
    // setting up Buttons and Drop down menus
    char a[];
    Choice choicebutton;
    JLabel resultLabel;
    JTextField result;
    JLabel enterLabel;
    JTextField enter;
    JButton pushButton;
    TreeTest PicW;
    // setting up applets G.U.I
    public void init(){
    // Get content pane and set it's layout to FlowLayout
    Container container = getContentPane();
    container.setLayout( new FlowLayout() );
    // initialise buttons and shit
    a = new char[30];
    choicebutton = new Choice();
    enterLabel = new JLabel("Test");
    enter = new JTextField(30);
    resultLabel= new JLabel("speech label");
    result = new JTextField(30);
    result.setEditable(false);
    // Add items to Choice Button
    choicebutton.addItem("abc");
    choicebutton.addItem("def");
    choicebutton.addItem("ghi");
    choicebutton.addItem("jkl");
    pushButton = new JButton("Click to continue");
    // Add new Tree from file TreeTest.java
    PicW = new TreeTest();
    // Add buttons to container.
    container.add(resultLabel);
    container.add(result);
    container.add(enterLabel);
    System.out.println("");
    container.add(choicebutton);
    System.out.println("");
    container.add(pushButton);
    pushButton.addActionListener(this);
    //choicebutton.addActionListener( this );
    // Set the text in result;
    result.setText("Hello");
    //public void paint(Graphics gg){
    // result.setText("Hello");
    public void actionPerformed(ActionEvent event){
    // continue when action performed on pushButton
    String searchKey = event.getActionCommand();
    System.out.println("");
    if (choicebutton.getSelectedItem().equals("abc"))
    PicW.getPicWeight(1);
    if (choicebutton.getSelectedItem().equals("def"))
    PicW.getPicWeight(2);
    if (choicebutton.getSelectedItem().equals("ghi"))
    PicW.getPicWeight(3);
    if (choicebutton.getSelectedItem().equals("jkl"))
    PicW.getPicWeight(4);
    System.out.println("repainting from actionPerformed method()");
    PicW.repaint();
    import java.applet.Applet;
    import java.awt.*;
    import java.util.*;
    public class TreeTest extends Applet{
    Tree BackgroundImageTree;
    Tree PlayerImageTree;
    Image snow,baby;
    int weight;
    public void getPicWeight(int w){
    weight = w;
    System.out.println("the new weight has been set at: "+weight);
    this.repaint();
    public void init()
    // initialising trees for backgound images and player images
    BackgroundImageTree = new Tree();
    PlayerImageTree = new Tree();
    // initialising images and correcting size of images to correctly fit the screen
    snow = getImage(getDocumentBase(),"snow.gif");
    baby = getImage(getDocumentBase(),"baby.gif");
    // inserting images into correct tree structure
    System.out.println("inserting images into tree: ");
    // inserting background images into tree structure
    BackgroundImageTree.insertImage(1,snow);
    // inserting players into tree structure
    PlayerImageTree.insertImage(1,baby);
    public void paint(Graphics g){
    System.out.println("Searching for selected Image");
    if((BackgroundImageTree.inorderTraversal(1)==null)&&(PlayerImageTree.inorderTraversal(1)==null)){
    System.out.println("There is no tree with the selected value in the trees");
    }else{
    g.drawImage(BackgroundImageTree.inorderTraversal(1),1,3,this);
    //g.drawImage(PlayerImageTree.inorderTraversal(1),55,150,this);
    import java.awt.*;
    import java.applet.Applet;
    class TreeNode {
    TreeNode left;
    Image data;
    TreeNode right;
    int value;
    public TreeNode(int weight,Image picture){
    left = right = null;
    value = weight;
    data = picture;
    public void insert(int v, Image newImage){
    if ( v< value){
    if (left ==null)
    left = new TreeNode(v,newImage);
    else
    left.insert(v,newImage);
    else if (v>value){
    if (right ==null)
    right = new TreeNode(v,newImage);
    else
    right.insert(v, newImage);
    public class Tree{
    private TreeNode root;
    public Tree() {
    root = null;
    public void insertImage(int value, Image newImage){
    if (root == null)
    root = new TreeNode(value,newImage);
    else
    root.insert(value,newImage);
    // in order search of tree.
    public Image inorderTraversal(int n)
    return(inorderHelper(root,n));
    private Image inorderHelper(TreeNode node, int n){
    Image temp = null;
    if (node == null)
    return null;
    if (node.value == n ){
    return(node.data);
    temp = inorderHelper(node.left,n);
    if (temp == null){
    temp = inorderHelper(node.right,n);
    return temp;
    }

    I can fix your problems
    1. You get an error here because you can only invoke the superclass's constructor in the subclass's constructor. It looks like that's what you're trying to do, but you're not doing it right. Constructors don't return any value (actually they do, but it's implied, so you don't need the void that you've got in your code)
    2. I'm not sure, but I think your call to show might be wrong. Move the setsize and setvisible calls to outside of the constructor

  • PDA is under the environment of Jeode, carry out applet question with swing

    Purpose : Under the environment of Jeode in PDA, links APPLET webpage on websites, and APPLET is " import javax.swing. *".
    Question: Not knowing the problem of how to go to solve swing bug of applet , it is unable to read webpages to cause pda.

    Right. Make "number" a field, and take it out of the
    method signature for paint.
    Because you didn't use the same signature, you didn't
    override the existing paint(Graphics) method, you
    just overloaded it. That means that when the GUI
    thread tries to make your applet paint itself, it
    calls the original paint(Graphics) method, and not
    your paint(Graphics, int) method -- and so your
    method never gets called.
    Hi Paul,
    Not to sure whether is this what you mean by above statement, i just understand the statement in bold, anyway i ammend the program , this time i declare another variable outside the init() and paint() call int num
    import java.awt.*;
    import javax.swing.*;
    public class Draw extends JApplet
        int num;
        public void init()
        \\ask user for input (1, 2 or 3) = String numberStr
        num = Integer.parseInt(numberStr)
        public void paint(Graphics page)
            for (int index = 0; index < 100; index++)
            switch (num)
            \\ my statement code
    }Anyway it works, thanks..:)
    my last assigment before my exam.

  • How to use mousedown applet function in swing?

    hai,
    i need to use the applet mousedown function in swing..
    is there any way to use it or any other alternative is available for this?
    if can provide me a sample code.

    >
    i need to use the applet mousedown function in swing..>There is no such class as 'applet' in the JRE, Swing has an upper case 1st letter, functions in Java are generally referred to as methods, and there is no 'mousedown' method in the JRE.
    OTOH a Swing JApplet inherits the mouseDown method from Component, and it was deprecated in Java 1.1. The documentation (JavaDocs) provides instructions on what to use instead.
    >
    is there any way to use it or any other alternative is available for this?
    if can provide me a sample code.>If can provide me cash. Short of that, you might actually need to do some research/coding of your own.
    As an aside. What does any of this have to do with Java 2D?

  • Please give me an exemple of an applet using a swing object.

    Please give me an exemple of an applet using a swing object.thank you.

    My problen is that the swing object do not appear in
    my applet. They appear only if i invoque the repaint
    methode.use JApplet, since awt components are heavyweight, and swing components are lightwieght, then your swing components get over painted with aplets background or something.
    anyhow, in your applet you may create JFrame, that would be swing component and if you set it visible, then it will be even visible.
    they say that mixing swing and awt is not good idea, especially when you don't know what you're doing (which might be true in your case)
    so try to migrate your app from AWT based stuff to SWING based stuff, or write your own AWT components that do the job whih you needed swing component for at the first place.
    but if you need to mix awt and swing, then i thing that you should not paint the fole area of applet in applets paint method -- but here i'm not sure, never mixed 'em.
    so you might try to create an applet which paint() method you leave empty and to which you add some JComponent*.
    and see what happens, maybe this JComponent will be visible.
    * -- JComponent is most likely just gray, you might want to add some subclass of it -- JButton, JTextField, JSomethingElse.

  • How to load an applet in a swing frame?

    Hi All,
    Can any one tell how to load a HTML applet in a Swing frame, I have a requirement where in the swing frame must contain a HTML applet.
    Thanks in advance...
    Panneer.

    Panneerselvam wrote:
    Can any one tell how to load a HTML applet in a Swing frame, I have a requirement where in the swing frame must contain a HTML applet.You don't. The requirement reeks of the ridiculous.
    Also, what is an "HTML" applet and how is it different from a regular applet or JApplet? I feel a case of jargonitis coming on.

  • Why the IE cannot open the Applet build by Swing

    Halo, i build a GUI inside an Applet, by using the Java Swing. althoug i have
    installed the Java plug in, and use the HTML converter, but when i try to use the internet explorer to open this applet, the exception is thrown, and it said the
    "Start: didnt initialize the applet" in the IE window.
    and this is the error message shown in the the Java Console:
    java.security.AccessControlException: access denied (java.io.FilePermission anny.gif read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkRead(Unknown Source)
         at sun.awt.SunToolkit.getImageFromHash(Unknown Source)
         at sun.awt.SunToolkit.getImage(Unknown Source)
         at javax.swing.ImageIcon.<init>(Unknown Source)
         at javax.swing.ImageIcon.<init>(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Anyone can help me in this problem? thank you very much

    the image saved with the class file of the applet, and this applet i will
    paste in the server, it is funny when i cut all the codes about the imageicons,
    then the IE can load the applet and show it ,
    and now i use the xx = new ImageIcon("xxx.gif"); to construct an imageicon in the java code of that applet,but it got the problem
    i want to konw whether can use xxx = new ImageIcon(url) will help me to solve this problem, and if it can, how format the url is, for example, the IP of my server is 172.20.54.152, and the image anny.jpg saved in C:/Javaprogram,
    can u tell me what is the solution.
    Thank you very much

  • Javax.swing.Timer not working or event not being captured by actionPerfrmd

    Here is the code:
    public class nQueensEst extends JApplet implements ActionListener {
      public Timer t = new Timer(1, this);
    //...the actionPerformed:
    if(e.getSource() == jButton1){
                nRainhas=Integer.parseInt(javax.swing.JOptionPane.showInputDialog("Quantas rainhas voc? deseja?"));     
                t.start();
                int contadorTentativas=1;
                for(int i=0; i<=100; i++){
                    sol=new int[nRainhas];
                    while(!rainhas()){
                      jLabel1.setText(contadorTentativas +" tentativas!!!");
                      contadorTentativas++;            
                    jLabel2.setText("Solu??es: "+Integer.toString(i));
    t.stop();
    }else if(e.getSource() == t){
         System.out.println("timer");
         rodadas++;
    Any clue?
    Thanks

    Let me explai the context: i had to implement a classic nQueens problem using a Grasp Algorithm and a Backtrack algorithm, then in dorder to compare them, i want to make the garap one to run find 100000 solutions and register the time it is needes, then divide by 100000. so i need the timer running and making a variable increase every millisecond from the beggining until the end of the last solution. But the timer is not generating a event or the event is not being caought by the actionPerformed.

  • NoClassFoundException javax.swing.JList

    Hi
    I have done a quite a lot of java applications but not applets.
    No trying to cover this I get problems with CLASSPATH I think.
    When running my test applet with just one task in init() add a Jlist I get the NoClassFoundException javax.swing.JList what am I doing wrong how does this work ?

    You should use this code for your Applet: (insteed of <applet ...>)
    <OBJECT codetype="application/java" NAME="theName"
    WIDTH = 450 HEIGHT = 250 classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">
    <PARAM NAME = NAME VALUE = "theName" >
    <PARAM NAME = CODE VALUE = "theName.class" >
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3.0">
    <PARAM NAME = MAYSCRIPT VALUE = true >
    <PARAM NAME="scriptable" VALUE="true">
    <EMBED NAME="theName" MAYSCRIPT=true scriptable=true type="application/x-java-applet;version=1.2" java_CODE = "theName.class" WIDTH = 350 HEIGHT = 250 pluginspage="http://java.sun.com/products/plugin/1.2/plugin-install.html"></EMBED>
    </OBJECT>
    This will use JRE1.3. If this is not installed on the client maschine jre is installed automaticly.
    MayScript and Scriptable are used to connect the Apllet via JavaScript.
    I hope this could help.
    J&ouml;rn

  • Cannot find class javax.swing.JOptionPane

    Hello,
    I imported the class
    import javax.swing.JOptionPane;and written as a first line of my code in the form of a .java file.
    but error occurs as : cannot find the class javax.swing.JOptionPane. What should I do.
    Thank you.

    Are you doing something likeimport javax.swing.JOptionPane;
    class Test {
        public static void main(String args[]) {
            JOptionPane.showMessageDialog(null, "Testing",
                    "Testing", JOptionPane.INFORMATION_MESSAGE);
    }Mark

  • Multiple Fonts in a javax.swing.JTextPane

    I am trying to use multiple fonts in a JTextPane, but can only find ways of changing the font family used. Can anyone give me any pointers on how to do this, or a document somewhere that explains, either way with out going into the javax.swing.text.html, javax.swing.text.html.parser or java.awt.font packages.
    Any information that can be provided would be appreciated.
    Thanks,
    Nathan

    Just use SimpleAttributeSet like :
    SimpleAttributeSet defaultSet = new SimpleAttributeSet();
            StyleConstants.setForeground( defaultSet, Color.BLACK );
            StyleConstants.setFontFamily( defaultSet, "Verdana" );
            StyleConstants.setFontSize( defaultSet, 14 );
            SimpleAttributeSet navigationSet = new SimpleAttributeSet();
            StyleConstants.setForeground( navigationSet, new Color(00, 99, 00) );
            StyleConstants.setBold( navigationSet, true );
            StyleConstants.setFontFamily( navigationSet, "Verdana" );
            StyleConstants.setFontSize( navigationSet, 11 );
    // just defiine endPoints what ever you want
    ((DefaultStyledDocument)textPane.getDocument()).setCharacterAttributes(0, endPoint1, defaultSet , true)
    ((DefaultStyledDocument)textPane.getDocument()).setCharacterAttributes(0, endPoint2, navigation , true)

Maybe you are looking for

  • Document in status not posted' trip cannot be changed"

    Dear Gurus, I have a situation here that,  iam unable to change the expenses, iam getting the following message. "document in status not posted' trip cannot be changed" The Posting run was created for this trip, which was  accidentally deleted,  from

  • When connect appletv to tv it is asking to check the resolution and change the resolution

    First time when I am connecting appletv to SamsungTV it is asking to check the resolution and change the resolution.

  • Can we call a static method without mentioning the class name

    public class Stuff {      public static final int MY_CONSTANT = 5;      public static int doStuff(int x){ return (x++)*x;} import xcom.Stuff.*; import java.lang.System.out; class User {    public static void main(String[] args){    new User().go();  

  • How to modify the code???

    Hello forum, I have code for retriving data from database. I want to retrieve more than one row but the code only retrive the last row. How to mdify the code??? SorryI am new in Servlet and JDBC. Here is the codeimport java.io.*; import java.text.*;

  • Conditional insertion into a table

    Hello: I've a base table into which records are inserted from results returned by a query. The query always runs on the current date every hour. There are some preconditions before insertion: 1) The backdated records will remain as it is; 2) If query