How do I load an applet in a JSP?

i have coded an applet in a JSP, the page loads without any errors, but I am not able to view the applet. Any clues? thanks in advance

I have never seen anyone do this where it turned out to be a good idea. That said...
1. Application servers usually don't allow extraneous files to be placed in the application root. they will generate a security exception in the app server when trying to load.
2. Applets can only access the server they were loaded from. If the app server uses the page 10.1.1.2 and you are using www.myserver.com as the codebase, it won't work.

Similar Messages

  • How can i load a applet in a jsp page

    hi ,
    i am chiranjit , i am working in a jsp project . i want to load a applet in a jsp page.previously i had tried this one through <jsp:plugin> but when it goes in cross platform this page unable to load the applet from the serverside.
    if have any solution then pls send the solution in forum.
    thank you.
    chiranjit

    I never tried this... but doesn't the normal html <applet> tag work?

  • How can I use a applet in a JSP file?

    hi
    I failed to use applet in a jsp file.My workspace is a BC4J type. I put the applet's source file in business component project.the jsp is in JSP project.
    The jsp file calls applet by <jsp:plugin></jsp:plugin> style.
    The error is can't find the applet class.
    why? Thank someone for give me help.

    Actually using jsp applet tags does not mean that it is taking care of that the classes are available. It simply renders the Applet tag tothe JSP page. If e.g. teh codebase is specified as /java/, then there should be a mapping to the Java class location with thename of /java/. If codebase is not provided, then the Java class must be in the classpath of the JSp servlet.
    Frank

  • How can I load an applet using Java Plug-in?

    I have written an applet and have tested with appletviewer, but I can't load it from a browser. Ghlin told me that I need to use Java Plug-in to load it. Please tell me how.

    Click on the Products and API link at the top left of this page. Download the Java Plugin. Be sure to get the developers version. Inside that developer's version there is a tool called HTMLConverter. Run HTMLConverter on your HTML and it will modify the applet tag in such a way that if the user already has the Java Plugin then it will use it. IF not, then the user will be asked if he wants to download it.

  • Cant load an applet in a JSP under tomcat localhost

    Hi, i am currently running tomcat 5.5. I load a jsp with an applet plugin on the host machine and it runs fine but when I try to connect to tomcat server from another pc he jsp loads but the applet does not. I get the following error.
    java.lang.NoClassDefFoundError: org/jfree/data/category/CategoryDataset
         at java.lang.Class.getDeclaredConstructors0(Native Method)
         at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
         at java.lang.Class.getConstructor0(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         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)
    <!-- Fig. 10.15: plugin.jsp -->
    <html>
       <head>
          <title>Wireless Sensors</title>
       </head>
       <body>
          <jsp:plugin type = "applet"
             code = "Charts" archive="jfreechart-1.0.4.jar, jcommon-1.0.8.jar, mysql-connector-java-3.0.10-stable-bin.jar, substance.jar"
             width = "980"
             height = "580">
             <jsp:params>
                <jsp:param name = "red" value = "255" />
                <jsp:param name = "green" value = "255" />
                <jsp:param name = "blue" value = "0" />
             </jsp:params>
          </jsp:plugin>
       </body>
    </html>If more detail is needed i can supply it no problem. I think the problem is when accessing the localhost from another PC the jar files I am using can not be seen. I am lost if anybody can help

    I have never seen anyone do this where it turned out to be a good idea. That said...
    1. Application servers usually don't allow extraneous files to be placed in the application root. they will generate a security exception in the app server when trying to load.
    2. Applets can only access the server they were loaded from. If the app server uses the page 10.1.1.2 and you are using www.myserver.com as the codebase, it won't work.

  • How to load an applet jar file?

    Hello everyone,
    I have an applet that uses my own jar file and approximately 6 third party jar files. I set up jar indexing (jar -i) which will download the jar files when they are needed. All seems to work well, but now I want to manually load the jar files which I cannot get working.
    When the applet starts, about 1/2 of the jar files are downloaded (because they are needed at startup). I then want to load the additional jar files in the background, after the gui is initialized. I have tried this using the below thread which is executed from within the applet's start method:
    // Try to load additional jar files in background by loading a class from each jar file.
    Thread loadClass = new Thread() {
      public void run() {
        System.out.println("Loading classes...");
        try {
          // Tried loading classes this way, doesn't work.
          getClass().getClassLoader().loadClass("pkg1.Class1");
          getClass().getClassLoader().loadClass("pkg2.Class2");
          getClass().getClassLoader().loadClass("pkg3.Class4");
          getClass().getClassLoader().loadClass("pkg4.Class4");
          /* Loading classes this way doesn't work either.
          Class.forName("pkg1.Class1");
          Class.forName("pkg2.Class2");
          Class.forName("pkg3.Class3");
          Class.forName("pkg4.Class4");
        catch(ClassNotFoundException e) {
          // First attempt to load a class (pkg1.Class1) throws exception.
          System.out.println("Can't find class: " + e.getMessage());
    loadClass.start();As you can see from above I am trying to load a class from each of the jar files so that the jar files would load into memory/cache. Unfortunately, it cannot find the classes. These are the errors from the java console:
    Loading classes...
    Loading: pkg1.Class1
    Connecting http://my.server.com/my_dir/pkg1/Class1.class with no proxy
    Connecting http://my.server.com/my_dir/pkg1/Class1.class with cookie "JSESSIONID=some_big_long_char_list"
    Can't find class: pkg1.Class1
    So it appears the jar file is not being downloaded. When I take away the dynamic jar loading (removing the "jar -i" & adding them all to the applet archive list) the thread executes correctly. So I know the class names, etc, are correct. How does one load an applet jar file?
    Any help/suggestions are appreciated.

    The above error I posted was because I forgot to index the jar files. That is why it couldn't find the jar file. I thought I was getting farther along with my problem, but I apparently just forgot to index the jars. I am now getting the problem that I got yesterday...
    The applet freezes/hangs when it hits the thread. The GUI never opens (even though I'm running this thread right after the gui shows). The java console quits responding and the applet just stays the grey screen. I also tried the invoke later that you suggested.
    public void start() {
      // ...initialize gui...
      // Applet freezes and remains grey, also the java console freezes.
      javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {
          System.out.println("Loading classes...");
          try {
            // When I comment out the below forName calls, the thread will still run evidenced through the done print statement.
            Class.forName("pkg1.Class1");
         Class.forName("pkg2.Class2");
         Class.forName("pkg3.Class3");
         Class.forName("pkg4.Class4");
            System.out.println("...Done loading classes");
          catch(Exception e)     {
            System.out.println("Can't find class: " + e.getMessage());
    }

  • ClassFormatError when attempting to load an applet from within a JSP

    Greetings everyone.
    I have a problem that i seem unable to solve.
    I've created a web application. I'm using Java 1.4.2_05 and Tomcat. Right now i'm trying to load an applet from a JSP and i'm getting an error that, try as i might, i can't understand why it happens.
    Here is some detailed info:
    The applet's code:
    package smpb.myapp.controllers;
    import java.applet.Applet;
    import java.awt.Graphics;
    public class GUIApplet extends Applet
         public void init()
         public void stop()
         public void paint(Graphics g)
                  g.drawString("Hey hey hey",20,20);
               g.drawString("Hellooo World",20,40);
    The JSP's code:
    <%@ page language="java"
                   import="java.util.*"
                   session="true" %>
    <%
         String name = (String) request.getSession().getAttribute("userName");
    %>
    <html>
         <head>
              <title>Login</title>
         </head>
         <body>
              <h1><p align="center">Application</p></h1>
              <br>
              Welcome <%= name %>! Thank you for logging in!
              <br><br><br>
              <applet align="middle" code="smpb.myapp.controllers.GUIApplet.class" codebase="./" archive="MyApp_applets.jar">
                   Your browser does not support this feature.
              </applet>
              <br><br>
              <a href='<%=request.getContextPath() + "/LogOut"%>'>Log Out</a><br>
         </body>
    </html>-------------------------------------------
    When i reach this JSP the applet fails to load and i get the following error message at the java console:
    Loading applet ...
    Initializing applet ...
    Starting applet ...
    Connecting http://127.0.0.1/MyApp/MyApp_applets.jar with no proxy
    Connecting http://127.0.0.1/MyApp/MyApp_applets.jar with cookie "JSESSIONID=A8EECE5E39458739C760D8907762C507"
    Last modified time and/or expiration value is not available.  Jar file will not be cached.
    Connecting http://127.0.0.1/MyApp/MyApp_applets.jar with no proxy
    Connecting http://127.0.0.1/MyApp/MyApp_applets.jar with cookie "JSESSIONID=A8EECE5E39458739C760D8907762C507"
    Connecting http://127.0.0.1/MyApp/smpb/myapp/controllers/GUIApplet.class with no proxy
    Connecting http://127.0.0.1/MyApp/smpb/myapp/controllers/GUIApplet.class with cookie "JSESSIONID=A8EECE5E39458739C760D8907762C507"
    Last modified time and/or expiration value is not available.  Jar file will not be cached.
    Connecting http://127.0.0.1/MyApp/smpb/myapp/controllers/GUIApplet.class with no proxy
    Connecting http://127.0.0.1/MyApp/smpb/myapp/controllers/GUIApplet.class with cookie "JSESSIONID=A8EECE5E39458739C760D8907762C507"
    java.lang.ClassFormatError: smpb/myapp/controllers/GUIApplet (Bad magic number)
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
         at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:157)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
         at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
         at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:561)
         at sun.applet.AppletPanel.createApplet(AppletPanel.java:617)
         at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1856)
         at sun.applet.AppletPanel.runLoader(AppletPanel.java:546)
         at sun.applet.AppletPanel.run(AppletPanel.java:298)
         at java.lang.Thread.run(Thread.java:534)
    Exception: java.lang.ClassFormatError: smpb/myapp/controllers/GUIApplet (Bad magic number)-------------------------------------------
    The JSP is in the root directory of the web application's path right along with the jar file. The jar file itself has the following structure:
    Archive:  HelpDesk_applets.jar
      Length     Date   Time    Name
            0  05-17-06 12:17   META-INF/
          106  05-17-06 12:17   META-INF/MANIFEST.MF
            0  05-10-06 17:14   smpb/
            0  05-10-06 17:14   smpb/myapp/
            0  05-12-06 16:50   smpb/myapp/controllers/
          794  05-12-06 17:15   smpb/myapp/controllers/GUIApplet.class
          900                   6 filesNow, i've tried loading the very same jar file that i use in the JSP through a static HTML which is virtually identical to the JSP i presented and everything works just fine. I've checked and rechecked to see if all the permissions to access the jar file were accurate, i checked to see if Tomcat had it's MIME settings correctly configured so that there was no chance that the files were being corrupted during the load (as that is a usual cause for the problem, or so i've gathered) but to no avail. I've searched the web, including these forums, and found similar problems but no conclusive solution. I can't seem to figure out, at all, what could possibly be wrong. Does anyone have any ideas? I've tried to be as thorough as i could from the start, so, any help would be deeply appreciated.

    Hi mshah101,
    This can happen if the applet is compiled using an higher version of java and the browser is pointing to an older version (even if minor version number is higher)

  • Calling applet in a jsp

    Hi
    How do i include an applet in a jsp file.I need to send a parameter to
    the applet as well .
    Thanks

    You use an HTML Applet tag:
    http://java.sun.com/j2se/1.4.1/docs/guide/plugin/developer_guide/using_tags.html

  • Trouble with an applet on  a jsp page

    hi, thanx for readin it!
    im developing a webapp tha have some swing applets , the problem is that the applets dont work, they appear but dont play anything, i use the jsp:plugin to load the applets on the jsp, i also have instaled the java plugin on my win xp pc, i use tomcat 5. well i hope you can help me

    were are the applet classes? under WEB-INF? If so, then they shouldn't be as the server won't server files under that directory and the browser needs them

  • How to load an Applet application for 1000cards?

    Hi Friends..
    I want to know How to load an Applet application for 1000cards?..
    Assume that, i have an Applet application that need to loaded into 1000cards..
    So, how to solve this?
    Do i must to load an application manually for each card?
    Is there any another way?
    Thanks in advance..

    for 1000 cards you can use a "small" printer like an evolis "dualis" or something like that
    we've produced thousands of cards with this method in my company.
    the pro is that you can also print the cards in the same time.
    they usually have simple APIS like get_new_card_from_loader(), put_card_on_contacts(), eject_card()
    you can connect any reader on the printer , the raw card contacts are available on a connector.
    some printers also have contactless couplers.
    but remember that deploying cards in the field is not just loading an applet.
    it's also a cryptographic challenge, you need to change the card keys or anyone will be able to play with your cards, adding and removing applets as they want.
    typically this is achieved by using an ultra secret mother key and whatever derivation algorithm you like using data from INIT UPDATE as diversifier. example, you can TDES cipher part of the INIT UPDATE data using the mother key as TDES key, or use something involving SHA1, using a HSM if you are serious, etc.
    for your entertainment here is a high volume card personnalization machine. That's amazing.
    http://www.youtube.com/watch?v=6ZBF_yKRF5w

  • 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)

  • How to know the size of the EEPROM after loading any Applet

    How can I know the size of the EEPROM after loading any applet..
    Any comments on this is appreciated
    Thank you in advance

    kishansaralaya wrote:
    Thanks for your suggestion.
    But when I try to use
    short memRemaining = JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_PERSISTENT);
    it always shows 32767. Even after loading some applet.
    And I am using 72K Java card then how it can show only 32Kbyte as the remaining memory value.This is because a short isn't big enough to display a number above 32767. One way around this is to use a byte[] to fill up some of the space with your temporary applet.
    byte[] memoryFiller = new byte[32767];
    short memRemaining = JCSystem.getAvailableMemory(JCSystem.MEMORY_TYPE_PERSISTENT);The value of memRemaining + 32767 is the amount of persistent memory left on the card. If memRemaining is still 32767, you can add another byte[] starting with small values and increase the size until you get a meaning ful result (less than 32K).

  • How to load an applet in card?

    Hi everyone,
    I use NetBeans and its JavaCard Simulator, protocol T = 0, and I am wandering how to load an applet using APDU tool instead of clicking on Run Projetc which do the mentioned thing. It would be helpfull if someone post ouptut and explain all used apdu commands.
    Thanks,
    Mare.

    Here is the APDU trace:
    Select Card Manager
    => 00 A4 04 00 08 A0 00 00 00 03 00 00 00 00
    <= 6F 10 84 08 A0 00 00 00 03 00 00 00 A5 04 9F 65
        01 FF 90 00
    Authenticate
    cm>  init-update 255
    => 80 50 00 00 08 09 41 55 62 DF F5 61 2B 00
    <= 00 00 C6 D8 6A 1C B2 02 14 13 FF 02 00 00 93 73
        3A B8 2C 0F 8E A4 1D EF 84 60 77 12 90 00
    cm>  ext-auth plain
    => 84 82 00 00 10 B5 AA A8 E6 8B 73 57 F9 5D 37 6C
        D1 FE CF 56 32
    <= 90 00
    Install For Load
    => 80 E6 02 00 12 05 11 11 11 11 11 08 A0 00 00 00
        03 00 00 00 00 00 00 00
    <= 00 90 00
    Load Block 1
    => 80 E8 00 00 FF C4 82 01 65 01 00 1A DE CA FF ED
        02 02 04 00 01 05 11 11 11 11 11 0A 68 65 6C 6C
        6F 57 6F 72 6C 64 02 00 21 00 1A 00 21 00 0A 00
        0B 00 2A 00 0E 00 A1 00 0A 00 17 00 00 00 5A 02
        5A 00 00 00 00 00 00 01 01 00 04 00 0B 01 02 01
        07 A0 00 00 00 62 01 01 03 00 0A 01 06 11 11 11
        11 11 11 00 08 06 00 0E 00 00 00 80 03 00 FF 00
        07 01 00 00 00 1C 07 00 A1 00 01 10 18 8C 00 04
        7A 05 30 8F 00 09 3D 8C 00 02 18 1D 04 41 18 1D
        25 8B 00 03 7A 04 22 18 8B 00 07 60 03 7A 19 8B
        00 06 2D 1A 04 25 75 00 6D 00 06 00 00 00 1D 00
        01 00 2C 00 02 00 3B 00 40 00 4A 00 41 00 57 00
        42 00 62 19 8B 00 05 3B 19 03 1A 07 25 8B 00 08
        70 49 19 8B 00 05 3B 19 03 1A 07 25 8B 00 08 70
        3A 19 8B 00 05 3B 19 03 1A 07 25 8B 00 08 70 2B
        03 32 04 8D 00 00 32 1F 8D 00 01 70 1E 05 8D 00
        00 32 1F 8D 00
    <= 00 90 00
    Load other Blocks with  80 E8 00 xx ... which xx is the Block number
    Load Last Block
    => 80 E8 80 01 6A 00 01 70 13 03 8D 00 00 32 1F 8D
        00 01 70 08 11 6D 00 8D 00 01 7A 08 00 0A 00 00
        00 00 00 00 00 00 00 00 05 00 2A 00 0A 06 80 08
        10 06 80 07 01 06 00 00 01 03 80 03 02 06 80 03
        00 03 80 0A 06 03 80 0A 01 03 80 03 03 03 80 0A
        08 01 00 02 00 09 00 17 00 00 00 13 05 06 04 0A
        07 07 25 09 06 09 06 09 08 05 06 05 06 05 08 00
    <= 00 90 00
    Install For Install
    cm>  install -i 111111111111  -q C9#() 1111111111 111111111111
    => 80 E6 0C 00 1A 05 11 11 11 11 11 06 11 11 11 11
        11 11 06 11 11 11 11 11 11 01 00 02 C9 00 00 00
    <= 90 00Note that if you want to use APDU manually, you should do the authenticate process and loading all blocks of the CAP file yourself.
    Note that this is the APDU for a real card that is executed in JCOP Environment. I think it should work for the simulators too except the authentication commands.

  • How to load java applet to java-enabled card

    I have downlaoded the sdk n run some samples. but when i connect the card as through pcsc reader, and tried to install some ready applet in the card explorer,it fail n give me 6a80.
    How can i load a java card applet into a java-card?

    You will need a loader. To develop a loader, you will need to follow the steps outlined in the Global Platform specs to establish a secure channel and install.

  • How can i hnow the applet had load complet by javascript?

    hi,how can i hnow the applet had load complet by javascript?
    my applet load by <object> tag,
    i add a "onload" event listener to the html page's <body> tag,but the event listener is call by the page load,
    but ,the applet sometime has not loaded complet,so how can i know the applet had loaded complet!
    the <OBJECT>has some method to check the applet load status??
    3KS!

    You can have your applet call some javascript to inform that it is loaded. Make the call from your
    applet's start method
    Suppose you have a javascript function called "appletReady()"
    which sets a ready variable to true or whatever.
    Now in your start method of your applet you can do the following:
           JSObject win = null;
            try
                win = (JSObject)JSObject.getWindow((Applet)this);
                if (win == null)
                    System.err.println("JSObject window was null");
                else
                        win.call("appletReady",null);
            catch (Exception jse)
                System.err.println("Exception: " + jse);
            }Make sure you import netscape.javascript.
    And when you compile use the appropriate jaws.jar in your classpath
    It should be found under jre/lib of your JDK installation.
    I hope this helps.

Maybe you are looking for

  • Open order quantity in ME5A report

    Dear All, How to get the open ordered quantity in the transaction ME5A. Regards, Venkat.

  • How to set the number of contents in list area of t:selectOneMenu

    Hi all Can any one plz suggest me how to fix size of number listed elements in <h:selectOneMenu> or <t:selectOneMenu>. I want to set this size to 10 so that i can control dropdown list size, which appeared quite long and shadows large screen area as

  • How to include original message body in the reply to a workflow notificatio

    Hi, I have a requirement from my clients. Standard Functionality: When a Manager clicks on the APPROVE (button / link) to approve a workflow notification from a mailing application, a (response) mail gets composed to the Workflow Mailbox with the NID

  • Compressor won't do distributed processing with FCPX.

    Running 4.1.3 with FCPX and Send to Compressor has all of the distributed processing groups greyed out in the selection drop down. I can only run compressor on This Computer. If I export the file from FCPX and then drop that into Compressor from the

  • Prem Pro CS3. Title screen resizes itself.

    Each time I open the titling screen it will gradually enlarge the two left hand panels (a little each time I open it) eventually squeezing the right hand side properties panel (fonts etc) down to almost nothing. I have to keep dragging things back to