Applets and local classes

Hi
I have recently had to do some applet redevelopment because of some security changes introduced in jdk1.5. In the old install of the application some files were copied from the install cd to the users jvm\classes folder. These files were then used from the applet when it was downloaded from the web server. I now want to include some of these files in the jar file that contains the applet rather than use the local version installed on the users machine. The JVM seems to pick up the local classes before the ones contained in the jar. Is this by design ? or has anyone seen similar behaviour ?
Thanks
Paul

There is a seporate applet forum here.
My guess is because you are using the depreciated applet tag the applet is run with the
msjvm. This is version 1.1.2 and eaven when it can read the class file it does not support
swing (since 1.2 I think).
First of all try to use the object tag
http://java.sun.com/products/plugin/versions.html
http://forum.java.sun.com/thread.jspa?threadID=455931&messageID=2079929
If it still doesn't work check if code and codebase are correct:
http://java.sun.com/j2se/1.4.2/docs/guide/misc/applet.html (works the same for object
as for applet)
If it still doesn't work try to inspect the full trace:
To turn the full trace on (windows) you can start the java console, to be found here:
C:\Program Files\Java\j2re1.4...\bin\jpicpl32.exe
In the advanced tab you can fill in something for runtime parameters fill in this:
-Djavaplugin.trace=true -Djavaplugin.trace.option=basic|net|security|ext|liveconnect
if you cannot start the java console check here:
C:\Documents and Settings\userName\Application Data\Sun\Java\Deployment\deployment.properties
I think for linux this is somewhere in youruserdir/java (hidden directory)
add or change the following line:
javaplugin.jre.params=-Djavaplugin.trace\=true -Djavaplugin.trace.option\=basic|net|security|ext|liveconnect
for 1.5:
deployment.javapi.jre.1.5.0.args=-Djavaplugin.trace\=true -Djavaplugin.trace.option\=basic|net|security|ext|liveconnect
The trace is here:
C:\Documents and Settings\your user\Application Data\Sun\Java\Deployment\log\plugin...log
I think for linux this is somewhere in youruserdir/java (hidden directory)

Similar Messages

  • Java Applets and multiple classes not working.

    I have tested my JApplet class alone to view its layout and to make sure it actually works. But once I add in my other classes, compile, jar, and test I get the error:
    java.lang.NoClassDefFoundError: AlakApp (wrong name: alak/codeFiles/AlakApp)
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    4)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
            at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:155)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:127)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
            at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:618)
            at sun.applet.AppletPanel.createApplet(AppletPanel.java:779)
            at sun.applet.AppletPanel.runLoader(AppletPanel.java:708)
            at sun.applet.AppletPanel.run(AppletPanel.java:362)
            at java.lang.Thread.run(Thread.java:619)My Directory contains these and only these:
    F:\alak\codeFiles:
      AlakApp.java
      Game.java
      Board.java
      Space.java
      index.html
      AlakGame.jarAll my classes are in the package alak.codeFiles.
    My .html file contains this:
    <HTML>
    <HEAD>
      <TITLE>ALAK</TITLE>
    </HEAD>
    <BODY>
      <applet code="AlakApp.class" archive="AlakGame.jar" width=400 height=200>
      Please use a Java compatible browser to see this.
      </applet>
      <br>
    </BODY>
    </HTML>These are they commands I am issuing:
    F:\alak\codeFiles>javac *.java
    F:\alak\codeFiles>jar -cvf AlakGame.jar *.class
    F:\alak\codeFiles>appletviewer index.htmlI've been trying many different things to narrow down what is going on. If you need to see my code let me know, but I've tested everything with a text-based user interface and they work.
    So does anyone know the cause of this error?

    Ok i rared the test and uploaded to rapidshare.. here is the link:
    http://rapidshare.com/files/76860865/test.rar.html
    But here is the code. They are in the directory /test/files/
    ADigit.java
    package test.files;
    public class ADigit
      private int value;
      public ADigit( int val )
       this.value = val;
      public String toString()
       return "" + this.value;
    }ADigitApp.java
    package test.files;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ADigitApp extends JApplet implements ActionListener
      private ADigit numeroUno;
      private int currentNum;
      private Container container;
      private javax.swing.JLabel jLabel;
      private javax.swing.JTextArea jTextArea;
      private javax.swing.JButton jButton;
      public void init()
        currentNum = 1;
        numeroUno = new ADigit( currentNum );
         container = getContentPane();
        container.setLayout( new BorderLayout() );
         jLabel = new javax.swing.JLabel();
         jTextArea = new javax.swing.JTextArea();
         jLabel.setText( "The Number is: " );
         jTextArea.setText( numeroUno.toString() );
         jButton = new javax.swing.JButton();
         jButton.setText( "New Number" );
        jButton.addActionListener( this );
         container.add( jLabel, BorderLayout.WEST );
         container.add( jTextArea, BorderLayout.CENTER );
         container.add( jButton, BorderLayout.EAST );
        setSize( 200, 200 );
      public void actionPerformed( ActionEvent e )
        this.currentNum++;
         numeroUno = new ADigit( this.currentNum );
         jTextArea.setText( numeroUno.toString() );
    }index.html
    <HTML>
    <HEAD>
      <TITLE>NUMBERSSSS</TITLE>
    </HEAD>
    <BODY>
      <applet code="ADigitApp.class" archive="NumberFun.jar" width=200 height=200>
      Please use a Java compatible browser to see this.
      </applet>
      <br>
    </BODY>
    </HTML>Commands:
    /test/files>javac *.java
    /test/files>jar -cvf NumberFun.jar *.class
    /test/files>appletviewer index.htmlThis example produces the same style of error.

  • Custom class loader and local class accessing local variable

    I have written my own class loader to solve a specific problem. It
    seemed to work very well, but then I started noticing strange errors in
    the log output. Here is an example. Some of the names are in Norwegian,
    but they are not important to this discussion. JavaNotis.Oppstart is the
    name of my class loader class.
    java.lang.ClassFormatError: JavaNotis/SendMeldingDialog$1 (Illegal
    variable name " val$indeks")
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:431)
    at JavaNotis.Oppstart.findClass(Oppstart.java:193)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    at JavaNotis.SendMeldingDialog.init(SendMeldingDialog.java:78)
    at JavaNotis.SendMeldingDialog.<init>(SendMeldingDialog.java:54)
    at JavaNotis.Notistavle.sendMelding(Notistavle.java:542)
    at JavaNotis.Notistavle.access$900(Notistavle.java:59)
    at JavaNotis.Notistavle$27.actionPerformed(Notistavle.java:427)
    JavaNotis/SendMeldingDialog$1 is a local class in the method
    JavaNotis.SendMeldingDialog.init, and it's accessing a final local
    variable named indeks. The compiler automatically turns this into a
    variable in the inner class called val$indeks. But look at the error
    message, there is an extra space in front of the variable name.
    This error doesn't occur when I don't use my custom class loader and
    instead load the classes through the default class loader in the JVM.
    Here is my class loading code. Is there something wrong with it?
    Again some Norwegian words, but it should still be understandable I hope.
         protected Class findClass(String name) throws ClassNotFoundException
             byte[] b = loadClassData(name);
             return defineClass(name, b, 0, b.length);
         private byte[] loadClassData(String name) throws ClassNotFoundException
             ByteArrayOutputStream ut = null;
             InputStream inn = null;
             try
                 JarEntry klasse = arkiv.getJarEntry(name.replace('.', '/')
    + ".class");
                 if (klasse == null)
                    throw new ClassNotFoundException("Finner ikke klassen "
    + NOTISKLASSE);
                 inn = arkiv.getInputStream(klasse);
                 ut = new ByteArrayOutputStream(inn.available());
                 byte[] kode = new byte[4096];
                 int antall = inn.read(kode);
                 while (antall > 0)
                     ut.write(kode, 0, antall);
                     antall = inn.read(kode);
                 return ut.toByteArray();
             catch (IOException ioe)
                 throw new RuntimeException(ioe.getMessage());
             finally
                 try
                    if (inn != null)
                       inn.close();
                    if (ut != null)
                       ut.close();
                 catch (IOException ioe)
         }I hope somebody can help. :-)
    Regards,
    Knut St�re

    I'm not quite sure how Java handles local classes defined within a method, but from this example it seems as if the local class isn't loaded until it is actually needed, that is when the method is called, which seems like a good thing to me.
    The parent class is already loaded as you can see. It is the loading of the inner class that fails.
    But maybe there is something I've forgotten in my loading code? I know in the "early days" you had to do a lot more to load a class, but I think all that is taken care of by the superclass of my classloader now. All I have to do is provide the raw data of the class. Isn't it so?

  • Applet and Robot class???

    Alright, I want to write a java program uses the robot class (the class that allows for control of keybourd and mouse commands) would this work in an applet, or would it break the applet rules that ensure computer security on the web.

    i just want it to work on 1 computer, is there a way that i can override the things that dont work on the net?

  • Certification Applet and Signature class

    hi
    I need a Certification Applet . how can i use Signature class for signing data with RSA_SHA_PKCS1 ?
    i need a sample code. which class is better for this purpose? Signature class or Cipher class?
    thanks,
    siavash

    i used Signature class for signing data with RSA.
    how can i use private and public keys
    for signing and verification correctly?
    i signed my data with private key and verify it with public key,
    but verify method returns false.

  • Applet and Calendar class

    Hi,
    I am developing a Applet, which has lot of functions which needs calendar
    So i use Calendar.getInstance(); to get the instance if calendar
    But this applet will be used by clients all over the world,
    So i want to know, what will be the effect if i use Calendar.getInstance(); to get the instance of calendar,
    Any comments, help , or documents
    Thanx
    Ashish

    The timezone that the client machine, and the datetime format and all the other localized properties will be a part of the instance.
    Hope this helps.

  • Field symbol and local class.

    Hi, i have a problem, in my program i have this code:
    DATA ls_g_oref_appl_ctrl(30) TYPE C.
    FIELD-SYMBOLS: <fs_appl> TYPE REF TO cl_ftr_mj_appl.
    ls_g_oref_appl = '(SAPLTB4E)g_oref_appl'.
    ASSIGN (ls_g_oref_appl) TO <fs_appl>.
    The class: cl_ftr_mj_appl is defined in an include,not in the data dictionary.
    When the program try to assign the value to the field symbol, it returns a dump, with : ASSIGN_TYPE_CONFLICT.
    Any suggestions?  Thanks!
    Karla
    Edited by: Karla Tinoco on Mar 11, 2008 9:41 PM

    ls_g_oref_appl = '(SAPLTB4E)g_oref_appl'.
    1. Hope object g_oref_appl is create before you execute that ASSIGN statement.
    2. try writing (SAPLTB4E)g_oref_appl as (SAPLTB4E)G_OREF_APPL

  • APT and inner classes does not work.

    Hi
    Am I the only one who cannot make APT process local classes in methods, or anonymous classes. The are not declared in the APT definition of declared, but nor are they included!
    Also, has anyone had problems in that anonymous classes cannot be annotated using annotations, because there is no syntactic place to add metadata.
    But even so, I should like to process annotated methods in local or anonymous classes.
    -- Kasper

    By design anonymous and local classes are not visible in apt as the interiors of methods and constructors are not exposed.

  • MB_MIGO_BADI and use of local class of SAPLMIGO

    Hello
    I used the BADI MB_MIGO_BADI and methode LINE_MODIFY to change all i want on the ITEM. That's OK and all is working.
    But, because there is  a but...I'd like to check if the item fields are input fields, invisible fieds, etc, etc , exactly like on a loop at screen for example.
    For this, SAP use in standard in SAPLMIGO a local class named lcl_migo_screenmodification ( in include LMIGOSM3 of ECC5.0 ) with the methode get :
        get
          IMPORTING
            i_global_counter TYPE migo_global_counter   OPTIONAL
            i_field          TYPE migo_fieldname
            i_badi           TYPE abap_bool             OPTIONAL
          RETURNING
            value(r_status)  TYPE migo_fs_status,
    and this is perfect to know the attributes of each screen field, depending the status return.
    But, in the BADI, is it possible to use a local class during the run time of the MIGO  ? and HOW if possible ?
    thanks for your help

    Yep, this is exactly what class loaders are for. Create a URLClassLoader pointing to the specific URL you want the classes loaded from. Then use findClass on the ClassLoader to find a Class object, and newInstance on that Class object to get an instance of the class.
    Another thing you should do is completely empty out the user's classpath before running Java, so you know the only classes you're dealing with are the ones you're loading. Kinda hard for an applet, but controllable for an application.

  • Problem with local class, static private attribute and public method

    Hello SDN,
    Consider the following situation:
    1) I have defined a LOCAL class airplane.
    2) This class has a private static attribute "type table of ref to" airplane (array of airplanes)
    3) A public method should return the private static table attribute
    Problems:
    a) The table cannot be given as an EXPORTING parameter in the method because TYPE TABLE OF... is not supported and I get syntax errors. I also cannot define a dictionary table type because it is a local class.
    b) The table cannot be given as a TABLES parameter in the method because TABLES is not supported in the OO context.
    c) The table cannot be given as an EXPORTING parameter in the method defined as LIKE myStaticAttribute because my method is PUBLIC and my attribute is PRIVATE. ABAP syntax requires that all PUBLIC statements are defined before PRIVATE ones, therefore it cannot find the attribute to reference to with LIKE.
    I see only 2 solutions:
    a) Never ever use local classes and always use global classes so that I might define a dictionary table type of my class which I can then use in my class.
    b) Make the attribute public, but this goes against OO principles, and isn't really an option.
    Am I missing anything here, or is this simply overlooked so far?

    Hello Niels
    Since your class is local and, thus, only know to the "surrounding" application is does not really make sense to make it public to any other application.
    However, if you require to store instances of your local classes in internal tables simply use the most generic reference type possible, i.e. <b>OBJECT</b>.
    The following sample report shows how to do that. Furthermore, I believe it also shows that there are <u><b>no </b></u>serious inconsistency in the ABAP language.
    *& Report  ZUS_SDN_LOCAL_CLASS
    REPORT  zus_sdn_local_class.
    " NOTE: SWF_UTL_OBJECT_TAB is a table type having reference type OBJECT
    *       CLASS lcl_airplane DEFINITION
    CLASS lcl_airplane DEFINITION.
      PUBLIC SECTION.
        DATA:    md_counter(3)             TYPE n.
        METHODS: constructor,
                 get_instances
                   RETURNING
                     value(rt_instances)   TYPE swf_utl_object_tab.
      PRIVATE SECTION.
        CLASS-DATA: mt_instances    TYPE swf_utl_object_tab.
    ENDCLASS.                    "lcl_airplane DEFINITION
    *       CLASS lcl_airplane IMPLEMENTATION
    CLASS lcl_airplane IMPLEMENTATION.
      METHOD constructor.
        APPEND me TO mt_instances.
        DESCRIBE TABLE mt_instances.
        md_counter = syst-tfill.
      ENDMETHOD.                    "constructor
      METHOD get_instances.
        rt_instances = mt_instances.
      ENDMETHOD.                    "get_instance
    ENDCLASS.                    "lcl_airplane IMPLEMENTATION
    DATA:
      gt_instances      TYPE swf_utl_object_tab,
      go_object         TYPE REF TO object,
      go_airplane       TYPE REF TO lcl_airplane.
    START-OF-SELECTION.
      " Create a few airplane instance
      DO 5 TIMES.
        CREATE OBJECT go_airplane.
      ENDDO.
      gt_instances = go_airplane->get_instances( ).
      CLEAR: go_airplane.
      LOOP AT gt_instances INTO go_object.
        go_airplane ?= go_object.
        WRITE: / 'Airplane =', go_airplane->md_counter.
      ENDLOOP.
    END-OF-SELECTION.
    Regards
      Uwe<u></u>

  • How to load an applet with 2 classes and get it to display properly

    Ok I am a very newbie as you can tell by code below but I need help duh. I am a student taking a Java course on my own (ie no marks) so I know what I am doing in a second level java courseI am not sure if my problem is with "Forte for Java 4, CE" or my code. I have two files. Door.java and Exercise4a.java
    The code is as follows:
    Door.java
    package Exercise4.Exercise4a;
    import java.awt.*;
    import java.applet.*;
    public class Door extends java.applet.Applet {
    /** Creates a new instance of Door */
    int x;
    int y;
    public void init() {
    Graphics b;
    public Door(Point aPoint)
    x = (int)aPoint.getX();
    y = (int)aPoint.getY();
    public void paint(Graphics graphics)
    graphics.drawRect(0 + x ,0 + y, 20,30);
    graphics.setColor(Color.black);
    graphics.fillOval(15 + x,15 + y ,5,5);
    graphics.drawImage(buffer,0,0,this);
    public static void main(String args[]){}
    and Exercise4a.java
    package Exercise4.Exercise4a;
    import java.awt.*;
    import java.applet.*;
    public class Exercise4a extends java.applet.Applet {
    Graphics b;
    public void init() {
    Point a = new Point(0,0);
    Door door = new Door(a);
    My problem is that I do not see my door when I compile either file.
    What am I doing wrong? Is this acode problem. ie how do I load the graphics or is it that I am not compiling it correctly.

    package Exercise4.Exercise4a;
    import java.awt.*;
    import java.applet.*;
    public class Exercise4a extends java.applet.Applet {
    Graphics b;
    public void init() {
    Point a = new Point(0,0);
    Door door = new Door(a);// door.paint (b)

  • What is meant by Local Class and how we can create local classes in abap?

    Hi Friends
    what is meant by Local Class and how we can create local classes in abap?
    Regards,
    Sree

    Hi
    Local classes are the classes which we declare and use using the SE38 ABAP editor
    Global classes are the classes which we find in SE24 and call the methods of them into our program.
    see the sample code
    REPORT zs_class.
    SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS:p_var TYPE i,
    p_var1 TYPE i.
    SELECTION-SCREEN END OF BLOCK b1.
    CLASS d_class DEFINITION
    CLASS d_class DEFINITION.
    PUBLIC SECTION.
    METHODS:
    add,
    sub.
    PROTECTED SECTION.
    DATA : var2 TYPE i.
    ENDCLASS. "d_class DEFINITION
    CLASS d_class IMPLEMENTATION
    CLASS d_class IMPLEMENTATION.
    METHOD add.
    var2 = p_var + p_var1.
    WRITE:/ var2.
    ENDMETHOD. "add
    METHOD sub.
    var2 = p_var - p_var1.
    WRITE:/ var2.
    ENDMETHOD. "sub
    ENDCLASS. "d_class IMPLEMENTATION
    START-OF-SELECTION
    START-OF-SELECTION.
    DATA: obj TYPE REF TO d_class.
    CREATE OBJECT: obj .
    CALL METHOD: obj->add,
    Regards
    Anji

  • Local object and development class?

    wht r local objects ?
    and
    wht is development class?

    Hi,
    Local Objects are the Objects which are not transportable.They are saved in the server n we can't create a Tranport Request.
    Development classes collect together development environment objects that can be considered as a unit and should therefore also be corrected and transported together. A development class can, for example, consist of a transaction or a group of related transactions.
    You can say in simple word, Development class is like Folder which will have the collection of objects(Report, class etc) for a assigned Proejcts.
    If you save objects in Local Class ,you are not able to transport from one system to another.If you save it into a Development Class ,you can transport objects from one system to another.
    Have a look at these links.
    http://help.sap.com/saphelp_46c/helpdata/en/d1/80194b454211d189710000e8322d00/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/af/40bd38652c8c42e10000009b38f8cf/content.htm
    Regards,
    Priyanka.

  • Local class and function group

    I want to write a local class in a function group, where is the best place I put the code? thanks!

    The best practice (according to a paper written by Horst Keller and Andreas Blumenthal - "An insider's guide...") is to put the DEFINITION in the TOP include and the IMPLEMENTATION part in a separate include such as LZ...C01.
    Get the paper here: https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c2992ca9-0e01-0010-adb1-b7629adb623c
    Regards
    Edited by: Alejandro Bindi on Apr 25, 2009 12:46 AM

  • Applets and classes in jar files

    I have placed an applet and a group of classes that the applet uses in a jar file.
    The classes are grouped in their own files in a short directory tree within the jar file.
    When the applet is loaded by the browser on a client with the usual CODE="appletname.class" and ACRCHIVE="jarname.jar" statements, are the related class files and the directory tree also loaded into the client? Or do they remain at the server to be used by the applet as necessary?

    I'd say the entire JAR will be downloaded.

Maybe you are looking for

  • Old Appletalk Printer Stopped Working With Snow Leopard

    My old Apple 630 Pro Printer, which is connected to one of the Ethernet ports of my Time Capsule station, used to work perfectly through Appletalk... till I installed Snow Leopard. No more Appletalk in Snow Leopard, the printer is gone. If I could fi

  • Error in running the console in browser

    I am also getting the same problem as smith, for [wlserver6.1 with SP1, wlportal4.0, ebcc4.0, Windows NT4.0] the server has been started successfully, but if i try to start the console in the browser using(http://localhost:7501/console/index.jsp) am

  • Setup of HSRP on 3560

    The 3560 guide shows HSRP always setup under a physical ethernet interface, ie interface gigabit 1/0/1 Ip address x.x.x.x mask standby 2 ip x.x.x.x standby 2 priority 100 I am using my 3560 in L3 mode, can't i setup the HSRP under the VLAN interface?

  • Chd and characteristic values

    Hello, I got a problem with CHD command. call chnalloc("test", 100, 1) dim intloop for intloop = 1 to 100 chd(intloop, "test") = intloop next msgbox cmax("test") To my knowledge CHD recalculates the characteristic values(min, max, monotonicity, noval

  • MFX FILES not working at all in Final Cut X

    I am running the most recent version of Mountian Lion and have download the XF Plugin from Canon but when I go to import media and pick the MXF file, it only shows 30 seconds of the file.  So on one clip the size is 2gig but the view it only shows 30