Applet tag

Hi guys i'm having a bit of a problem with an applet.
I have an applet i am trying to run which imports one of my own classes from a different package. When i run this applet i get a NoClassDefFoundError on this imported class. I dont understand what the problem is, the classpath should be fine, i have had no problem using this class before and although i'm not to familiar with html i don't think i need to mention my imported class in the tag since the std java classes import ok.
just wondered if anyone could shed some light on the matter.
I would rather not use a jar file.
cheers
steve

My applet tag looks like:
<APPLET CODE="MyClass.class" WIDTH=300 HEIGHT=300>
<\APPLET>
now the problem i have is that appletviewer, or any of my browsers, cannot find a class 'utilities.MyUtil.class' that i have in a different path, which 'MyClass.class' needs, resulting in a NoClassDefFoundError.
after looking at an applet tutorial i thought that this maybe impossible without a jar file because of the security restrictions of applets.
i would be deeply indebted to you if you tell me this is not the case!

Similar Messages

  • Get JSP file to run with an applet tag under JDeveloper

    I Created an applet and an html file under JDeveloper. with the applet tag in the html file.
    when I run the html file the applet runs perfectly.
    I Created a jsp file in the same project with the applet and the html file under JDeveloper. I copied and pasted the applet tag from the html file to the jsp file.
    When I try to run the jsp file under JDeveloper I get
    java.io.FileNotFoundExceptions for all of the jar files in the Applet tag ARCHIVE and for the applet tag CODE
    This is the applet tag that I copied and pasted from the html file to the jsp file
    BEGIN:
    <APPLET CODE="myapplet.Applet1" ARCHIVE="jdev-rt.jar,ojsp.jar,ojsputil.jar,oc4j.jar,servlet.jar,ojc.jar" HEIGHT="200" WIDTH="200" ALIGN="bottom">This browser does not appear to support Applets.</APPLET>
    END:
    Here three example of the exceptions that I got BEGIN:
    1.
    java.io.FileNotFoundException: http://139.169.225.224:8988/JspToAppletWS-JspAppletInstantiation-context-root/jdev-rt.jar
    2.
    java.io.FileNotFoundException: http://139.169.225.224:8988/JspToAppletWS-JspAppletInstantiation-context-root/jdev-rt.jar
    3.
    java.lang.ClassNotFoundException: myapplet.Applet1
    Here three example of the exceptions that I got END:
    This is the html file that works BEGIN:
    <HTML>
    <HEAD>
    <TITLE>
    Title
    </TITLE>
    </HEAD>
    <BODY>
    <H2>
    This is sample HTML text.
    </H2>
    <BR>
    <APPLET CODE="myapplet.Applet1" ARCHIVE="jdev-rt.jar,ojsp.jar,ojsputil.jar,oc4j.jar,servlet.jar,ojc.jar" HEIGHT="200" WIDTH="200" ALIGN="bottom">This browser does not appear to support Applets.</APPLET>
    </BODY>
    </HTML>
    This is the html file that works END:
    This is the JSP file that does not work BEGIN:
    <!--%@ page contentType="text/html;charset=windows-1252"%-->
    <%@ page import = "myapplet.Applet1, java.util.Enumeration, java.util.Vector, javax.swing.JFrame, java.lang.*" contentType="text/html;charset=windows-1252"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>
    Hello World
    </title>
    </head>
    <body>
    <h2>
    The current time is:
    </h2>
    <p>
    <%= new java.util.Date() %></p>
    <APPLET CODE="myapplet.Applet1" ARCHIVE="jdev-rt.jar,ojsp.jar,ojsputil.jar,oc4j.jar,servlet.jar,ojc.jar" HEIGHT="200" WIDTH="200" ALIGN="bottom">This browser does not appear to support Applets.</APPLET-->
    </body>
    </html>
    This is the JSP file that does not work END:
    I would like to know what I need to do so that I can run
    the Jsp file under JDeveloper with the applet tag without any exceptions.

    Hi,
    I meet the same problem and can not get a solution from this forum or other forum in internet, either.
    Have you already solved this problem? Can you tell me your solution? thanks in advance.
    Regards

  • Accessing a File within a zip, which was archived using Applet Tag

    Hi,
    Could Any one please tell me, How to Access a File from within an Applet. The File resides inside a zip which was Archived using <Applet> Tag.
    Actually, I want to write an application which runs both online and offline. So I have chosen Applet and All the files Which I need are zipped and is Archived through <Applet ARCHIVE="example.zip">.
    Now I want to access those XML files which are inside example.zip from my Applet.
    How can I do that?
    I think I will get security Exception.
    How to get rid of this security Exception.
    Kindly Answer soon.......
    It's very urgent.
    Thanking you,
    KumudaRaj

    Did you already try signing a jarfile? If no ->>
    You can call a class inside a jar-file within the applet.
    if this class should be able to acces files the jarfile
    first has to be signed. to do this, you must generate a key.
    the complete work:
    1. write your applet
    2. write a html-page with following code:
    <APPLET code="guestbook.class" archive="guestbook.jar" width=600 height=400></APPLET>
    3. make a zip-file with the guestbook.class, guestbook.form, guestbook$1.class, guestbook$... and rename it to guestbook.jar
    4. in the console type:
    keytool -genkey -alias YOURNAME
    5. sign the key to your jarfile with:
    jarsigner guestbook.jar YOURNAME
    6. try the applet. a warning should appear which you have to answer
    with YES then it should work
    my trouble is that i cant acces files anyway because right now i don�t
    alreadv have the clue to get the right (absolute?) path for the file. means i get an ioexception because the applet cant find the file :-((
    does anyone know how to solve this problem then? my code is:
    FileReader Stream = new FileReader("/members/Ui97u8g4f6b89mj90kh5gbr4ecf6KXC4/guestbook.txt");
    ...

  • APPLET tag issue

    Hello
    When practicing coding applets I am getting the following error message:
    Your browser is completely ignoring the <APPLET> tag.
    Do I need to change a setting in IE?
    Thanks
    Steve

    Hello
    When practicing coding applets I am getting the
    following error message:
    Your browser is completely ignoring the <APPLET>
    tag.
    Do I need to change a setting in IE?
    Thanks
    SteveHello
    Any further suggestions on this please.
    I also have a query concerning Appletviewer. When I try to see my applet through DOS using aooletviewer (as opposed to looking at the HTML page - which doesn't show the applet anyway - maybe this is related to the post I have sent above), it doesn't work. It's as if DOS thinks the appletviwer is not in the c/java/bin directory (but it is).
    Any advice, please.
    Steve

  • applet tag regarding JAR file

    Is there something wrong with the following applet declaration?
    <applet code = "Sheep2.class" archive="Sheep2.jar" width = 500 height = 300
    ALT="If you could run this applet, you'd see a sky, a field, and a moon.">
    Your browser is completely ignoring the <APPLET> tag!
    </applet>
    Works fine (it seems) on my Windows 98 computer with IE 6.0280, but does not work on the same computer when I access the page calling the applet using AOL's v.9 browser.
    I used HtmlConverter to convert the above to Extended version (covering all platforms), and still does not work with AOL's browser. HtmlConverter reported no errors, but now IE shows an error icon in its status bar when I access the page even offline.
    Other html files I converted using HtmlConverter work fine with AOL's browser. They don't have "archive" attribute.
    What could be going wrong? My guess is JAR file reference is causing problems.

    I did more Html Conversion today. I ran one file which didn't show any error mark in the status bar of IE through HtmlConverter. I ran the new file generated by HtmlConverter and an error icon appeared in the status bar of IE. My Java Console didn't show any message. So, it must be an error in the applet related info HtmlConverter generated was not 100% html compliant..
    BTW, I started speculating the cause of my applets not working on the computer of oen of my friends is simply that her Java Plug-in cannot handle Swing components' J classes.

  • applet tag vs Object tag

    As per W3Schools HTML applet tag is not supported in HTML5. Need to use <Object> tag instead of <applet> tag.
    For more details follow this link: http://www.w3schools.com/tags/tag_applet.asp
    http://dev.w3.org/html5/spec/obsolete.html#the-applet-element
    Point 11.2 Non-conforming features
    So, I go ahead and the change the code as below depicted.
    Below code that is working with <APPLET> tag:
    +<Applet+
    style    = "position:absolute;border:0px;left:184;top:95;height:180;width:364;"
    code     = "jtreeviewapplet.JTreeViewAppletMain.class"
    name     = "TreeView"
    id       = "TreeView"
    hspace   = "0"
    vspace   = "0"
    align    = "top"
    archive  = "/Project/HTML/ABC/XYZ.jar,/Project/HTML/ABC/ABC.jar"
    MAYSCRIPT>
    +<PARAM NAME="onSelected" VALUE="onSelect_Handler">+
    +<PARAM NAME="onFinishNormalize" VALUE="onFinishNormalize_Handler">+
    +</Applet>+
    Here is the snippet, whcih have been changed to <OBJECT> tag so as to support HTML5 in future:
    +<OBJECT type=" application/x-java-applet"+
    style    = "position:absolute;border:0px;left:184;top:95;height:180;width:364;"
    name     = "TreeView"
    id       = "TreeView"
    hspace   = "0"
    vspace   = "0"
    align    = "top"
    +>+
    +<PARAM name="code" value=”jtreeviewapplet.JTreeViewAppletMain.class”>+
    +<PARAM name="codebase" value="/Project/HTML/ABC/">+
    +<PARAM name="archive" value=" XYZ.jar">+
    +<PARAM name="archive" value=" ABC.jar">+
    +<PARAM name="scriptable" value="true">+
    +<PARAM NAME="onSelected" VALUE="onSelect_Handler">+
    +<PARAM NAME="onFinishNormalize" VALUE="onFinishNormalize_Handler">+
    +</OBJECT>+
    After changing the *<applet>* tag to *<object>* tag , my applet itself is not loading and it gives class not found exception for jtreeviewapplet.JTreeViewAppletMain.class.
    (Note: For both working and not working condition, I am using latest JDK 1.7 update 9 for compiling the code and in my system I am having latest JRE1.7 update 9 to run the applet code. I am using InternetExplorer 8 and InternetExplorer 9 browser)
    Can anybody help me to find out where I am going wrong?
    Edited by: 975931 on Dec 12, 2012 1:24 AM

    You might want to stick to the documentation:
    http://docs.oracle.com/javase/tutorial/deployment/index.html
    and use the deployment toolkit.
    PS: use \ tags when posting anything code related. That makes it readable and it keeps the forum from trying to interpret it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Applet tag question

    I am working with applets and have been getting the classdefnotfounderror exception and a wrong name error.
    After pouring over the archives and messing around, I have found a
    solution to my problem, but I don't know why it works. I think it has to do with packages, but I'm not sure.
    I have two versions of Asteroids, one which has "package Asteroids" at the top
    of each file, and one that has no package.
    First with the version that is in a package: If I have the html file in the
    same directory as the class files, I cannot get the applet tag to work
    properly. If I back it up a directory (just outside the Asteroids directory), this works:
    <applet
      codebase = "."
      code     = "Asteroids/Asteroids.class"
      width    = "640"
      height   = "480"
    </applet>
    {code}
    One old post I found said that the wrong name error indicates that the qualified name is incorrect ( so my incorrect name would be Asteroids.class) and that the full name should include the package, so mine would be Asteroids/Asteroids.class, I think. Is that correct? If so, why wouldn't this code work inside the same directory as the class files?
    For the version that is not in a package, the opposite seems to work.
    {code:java}
    <applet
      codebase = "Asteroids/"
      code     = "Asteroids.class"
      width    = "640"
      height   = "480"
    </applet>
    {code}
    This code works for the version which is not in a package, but does not work for the version in a package, ( and vice versa for the code above). It seems like either code should work in either case. What am I missing?
    Thanks,
    Matt                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    I don't know what your understanding of packages and applet codebase is. These 2 tutorial sections should clarify your understanding, though.
    http://java.sun.com/docs/books/tutorial/java/package/index.html
    http://java.sun.com/docs/books/tutorial/deployment/applet/html.html

  • How to make pack200 work with applet tag ?

    Hello All,
    Sorry for the cross-post.
    I tired getting the advise on java.net forum but with no success. Can someone here please help with this or direct me to right direction.
    I am trying to use the pack200 compressed jars for my Object/Applet tag, but not sure how to go about using it.
    I have followed the instructions for jarsigned pack200 jars.
    http://java.sun.com/j2se/1.5.0/docs/guide/deployme.../deployment-guide/pack200.html
    But now how do i use them in my Object tag, what should i name the files in my cache_archive parameter :
    example:
    something like :
    <PARAM NAME = CACHE_ARCHIVE VALUE = "final.jar" />
    or :
    <PARAM NAME = CACHE_ARCHIVE VALUE = "final.jar.pack.gz" />
    renaming : final.jar.pack.gz --> final.jar ??
    I tried both the above options but none of them works.
    network: Wrote URL http://myserver.net/Stream/lib/final.jar to File C:\Documents and Settings\I025204\Application Data\Sun\Java\Deployment\cache\6.0\60\366763c-2a096009-temp
    java.util.zip.ZipException: ZIP file must have at least one entry
    at java.util.zip.ZipOutputStream.finish(Unknown Source)
    at java.util.zip.DeflaterOutputStream.close(Unknown Source)
    at java.util.zip.ZipOutputStream.close(Unknown Source)
    at com.sun.deploy.net.HttpDownloadHelper.download(Unknown Source)
    at com.sun.deploy.cache.Cache$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.deploy.cache.Cache.downloadResourceToCache(Unknown Source)
    at com.sun.deploy.cache.DeployFileOutputStream.close(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.close(Unknown Source)
    at java.io.BufferedInputStream.close(Unknown Source)
    at sun.plugin.PluginURLJarFileCallBack.downloadJAR(Unknown Source)
    at sun.plugin.PluginURLJarFileCallBack.access$000(Unknown Source)
    at sun.plugin.PluginURLJarFileCallBack$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.plugin.PluginURLJarFileCallBack.retrieve(Unknown Source)
    at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)
    at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
    Do i need to add something more .
    I am only allowed to use the below:as its the corporate policy for now.
    Java Plug-in 1.6.0_05
    Using JRE version 1.6.0_05 Java HotSpot(TM) Client VM
    Can someone please help me how to get the pack200 work in the Object tag ?
    Please advise.
    Thanks,

    InputStream in = sc.getResourceAsStream("application.jar.pack.gz");
            OutputStream out = response.getOutputStream();
            if (in != null) {
                try {
                    sendOut(in,out);
                } catch (IOException ioe) {
                    if (ioe.getMessage().compareTo("Broken pipe") == 0) {
                        sc.log("Broken Pipe while writing");
                        return;
                    } else  throw ioe;
            } else response.sendError(response.SC_NOT_FOUND);
    private void sendOut(InputStream in, OutputStream ostream)
                     throws IOException {
            byte buf[] = new byte[8192];
    System.out.println("send jar file");
            int n = in.read(buf);
            while (n > 0 ) {System.out.println(n);
                ostream.write(buf,0,n);
                n = in.read(buf);
            ostream.close();
            in.close();
        }the servlet code is above
    u should conifgure the servlet in the web.xml for urlmapping *.jar
    <servlet-mapping>
          <servlet-name>jarService</servlet-name>
          <url-pattern>*.jar</url-pattern>
        </servlet-mapping>where jarService is the name of the pack200 sevice servlet ContentType.java
    Edited by: kartheepanmirra on Jun 17, 2009 12:17 AM
    Edited by: kartheepanmirra on Jun 17, 2009 3:06 AM

  • JSP applet tag X Html applet tag (what is the difference?)

    what is the advantage in using the JSP applet tag instead of a simple Html applet tag ?
    second question:
    I have an applet in a Html frame, and a menu on the left side.... When the user select the applet option at first time, everything runs ok.. after the user select another option and then select the applet again, it fails in some features .. Why ?

    well, if by "the JSP applet tag", you mean the jsp:plugin tag.. that will just generate the same HTML tag you would write. The only advantage would be it should be less typing to use the taglib.
    second answer:
    without seeing any code, it'd be hard to figure out the problem. The obvious thing is you are setting some state of something that is preventing further action.

  • Applet tag accessing JAR file

    hi,
    I hope this is not a multi-post, I've searched high and low and I could not find an exact solution to my question...
    How can I load an applet in a browser using an applet tag? My main class is com.my.applet.MainClass.class and the its in a JAR. The jar is in ProjectName/WebContent/WEB-INF/lib/MyJar.jar (a Dynamic Web Project).
    Thx in advance

    i guess there is no solution for this one... i placed it in a resource folder instead... thx everyone...

  • APPLET tag missing CODE parameter

    We are planning to use WebStart for our swing_apps deployment. At the moment we use applets with Plug-In 1.3.1_04
    I changed the html as follows:
    <OBJECT CODEBASE="http://java.sun.com/update/1.3.1/jinstall-1_3_1_04-win.cab"
    classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="0" height="0">
    <PARAM NAME="app" VALUE="myServer/myWebApp/wsapps.jnlp">
         <PARAM NAME="back" VALUE="true">
         <!-- Alternate HTML for browsers which cannot instantiate the object -->
         Download Java Web Start
    </OBJECT>
    When loading the page from the server we get following error:
    "APPLET tag missing CODE parameter"
    When I load "myServer/myWebApp/wsapps.jnlp" directly from the browser, the application runs fine.
    any idea's?

    To have web start run your application, it just needs to open the JNLP file in the browser.
    You do not need the OBJECT tag since your are pointing it to a JNLP file and not an applet.
    just use an HREF to your JNLP file
    Run Application
    Dan

  • Applet tag and Object tag.

    Hi All,
    My application is hanging which is using Applet.I have specied in IE settings to use Sun's JVM[plug in].Applet tag is now depricated they [W3c] recommend to use Object tag for IE.Is my problem somewhere related to this?what difference does it make.?Please help me its very urgent.
    Cheers:
    Akash.

    Currently the applet is running through Applet tag.my application is using As400 emulator tn5250j which i am showing through Applet.The second frame is showing images. After entering data in As400 screen i am submitting data through submit button which is on second frame.but after submitting applet screen got hung.dont know the reason code seems to be fine.no memory leakages.
    thx for reply.

  • Can i load a class in subdirectoy  inside a jar file using applet tag?

    hi every one.. thank you for reading ... i am really in dire need for the solution..
    my problem is that i have a jar file contianing a package which inturn contains my applet class...
    i am trying to access this applet class using a applet tag in html file. this html file is in same directory as the jar file. i am having no problems in windows but when i am doing this in linux apache server i was getting class not found exception. (already checked the file permissions). and when i am successful when using simple package directory instead of jar file . so gist of my quesition is "can i load a class in subdirectoy inside a jar file using applet tag in a html file"?

    When you tested in Windows were you using Internet Explorer? On Linux you will be using a different browser, usually Mozilla of some version, or Firefox. Note that the HTML tags for applets will be different between the browsers if you are using the object tag. Principally the classid value for the object tag will differ between Firefox and Internet Explorer.

  • I have a sample applet tag in my browser

    Here is the applet tag in my browser
    <applet id="Laufschrift1" name="Laufschrift1" code=
    "TickerTape.class" codebase="../../scripts/" height="25"
    width="780">
    What does ../../scripts denote.
    As far as i know CODEBASE = ./ denotes the current directory or the classpath + the classname
    But i have seen CODEBASE = ../../scripts/ for the first time.
    Supposing that the webpage address is www.abc.com then CODEBASE = ../../scripts/ will be ??
    I am new to java and so i need someone's help

    "../" means "the directory above". So "../../scripts/" means "the directory named scripts located in the directory two levels above the current directory."

  • Javascript to Java using APPLET TAG

    Can I call an applet method using Javascript? The applet is exposed through the <APPLET> tag. I can easily do it using MS JVM but Sun JVM doesn't let me do it. I look at the plug-in documentation and it only mention using <OBJECT> when doing Javasript to Java.
    Thank you

    Possibly. I've never done it myself but I've seen reference to a a Javascipt <> Java communication package on these forums before which may be what you are looking for.
    Some info here:
    http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/packages.htm

Maybe you are looking for