Applet is viewed by appletviewer but not browser

Hello All:
I have created several applets, and they all can be viewed by appletviewer. Some of them can be viewed by both appletviewer and the browser, and I have Internet Explorer. I realized that if in an applet a class extends JApplet, then that applet cannot be viewed by the browser but appletviewer let you view it. Classes in all the other applets extends Applet, and these applets will easily be viewed by both browser and the appletviewer. Could someone please let me know what the problem is? My guess is the platform setting. The platform is J2EE, and each applet and the related files such as html file containing applet tag, etc are in the same directory.
Thanks,

it shows up and when i click it shows the mouse position if i somehow refresh the screen (like move some window over the applet )
it should be repainting but doesn't seem to either... and it doesn't seem to be reading from the file... but all this works fine with the appletviewer...
udam

Similar Messages

  • My applet works in the appletviewer but not in the navigator

    My applet works in the appletviewer but not in the navigator
    exceptions problem1 and problem2 are throwed
    this is my code
    import java.applet.*;
    import java.net.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ValiderHtml extends Applet implements ActionListener {
    JButton send =new JButton("Connexion");
    JScrollPane jscrollpane= new JScrollPane();
    DefaultListModel lignes=new DefaultListModel();
    JList lstURL = new JList(lignes);
    BufferedReader reader = null;
    String ligne;
    URL url;
    URLConnection conn;
       public void init(){   
       this.setSize(900,400);
       setLayout( new GridLayout(2,1));
       jscrollpane.setBounds(new Rectangle(19,53,160,73));
       jscrollpane.getViewport().add(lstURL,null);
       send.addActionListener(this);
            this.add(send);
       this.add(jscrollpane);
        public void actionPerformed(ActionEvent evt) {
             Send();
       public void Send(){
            try {
       url=new URL("http://www.developpez.com");
       conn = url.openConnection();
       reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    while ((ligne = reader.readLine()) != null) {
                     lignes.addElement(ligne);
        }//fin bloc try
       catch (Exception e) {
                   lignes.addElement("probleme1");     
                finally{
                   try{reader.close();}catch(Exception e){ lignes.addElement("probleme2");}
       }// fin Send
          public void paint(Graphics g) {
                super.paint(g);
    }// fin Applet

    As for tracking the source of your problem your applet sucks.
    Try e.printStackTrace() on a cought exception and check the (full) trace.
    url=new URL("http://www.developpez.com");
    Unless yor applet is on www.developpez.com this will throw an exception in an unsigned
    applet without special policies.
    Signing applets:
    http://forum.java.sun.com/thread.jsp?forum=63&thread=524815
    second post and last post for the java class file
    http://forum.java.sun.com/thread.jsp?forum=63&thread=409341
    4th post explaining how to set up your own policy with your own keystore

  • Applet works on appletviewer but not browser

    Hi,
    I have just started using Java. I'm so new the only program I've tried to compile and run is "Hello World". I'm already having problems running the applet. I'm using Java 2 SDK on Windows 2000. The applet works just fine on appletviewer, but I can't get it to work on Netscape or MS Internet Explorer. What am I missing?

    posting stuff like the error message you get, and a section of the html page might help.

  • Applet works in appletviewer but not in IE - Applet notinited

    Hi, i have written a simple applet which uses swing components, ie swing labels and buttons. The buttons and labels also have icons with the text. The icons are in a folder called "icons" inside the same folder that the class is in. Everything works fine in the appletviewer, the icons are all displayed correctly, however when i try to open it through Internet Explorer i get this error in the java console window:
    Java(TM) Plug-in: Version 1.4.0
    Using JRE version 1.4.0 Java HotSpot(TM) Client VM
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    p: reload proxy configuration
    q: hide console
    r: reload policy configuration
    s: dump system properties
    t: dump thread list
    x: clear classloader cache
    0-5: set trace level to <n>
    java.security.AccessControlException: access denied (java.io.FilePermission icons/world.jpg read)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
         at java.security.AccessController.checkPermission(AccessController.java:401)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
         at java.lang.SecurityManager.checkRead(SecurityManager.java:887)
         at sun.awt.SunToolkit.getImageFromHash(SunToolkit.java:408)
         at sun.awt.SunToolkit.getImage(SunToolkit.java:422)
         at javax.swing.ImageIcon.<init>(ImageIcon.java:81)
         at javax.swing.ImageIcon.<init>(ImageIcon.java:107)
         at atm.init(atm.java:23)
         at sun.applet.AppletPanel.run(AppletPanel.java:341)
         at java.lang.Thread.run(Thread.java:536)
    Can anyone help me with this problem? I desperately need this applet working in the browser and not just the appletviewer.
    Many thanks in advance,
    Adrian

    Hi, i don't think it is a problem with the security settings, the problem definately lies in these lines
    inside the init method:
         Icon worldIcon = new ImageIcon(getDocumentBase(),"icons/world.jpg");
         JLabel myIconLbl = new JLabel("My Icon and Label", worldIcon, SwingConstants.CENTER);     
    add(myIconLbl);
    If i take the ' getDocumentBase() ' part out of the first line, the applet compiles and the worldIcon is correctly displayed in the appletviewer but not in Internet Explorer (the problem i orriginally sited).
    However by leaving the getDocumentBase() line in the code, the applet correctly compiles but does not show the icons at all in either appletviewer or IE!!
    Any suggestions?
    Adrian

  • Applets work under older compilers, but not newest

    The applets I compile using the latest release of javac (with the JDK 1.4 package) work in the appletviewer but not in IE 6.0. However, if I use an older version of javac from a couple years ago (not sure the version), the applets work in IE suddenly. Is there something I need to install in IE to make it compatible with the Sun 1.4 javac compiler? Should I just reinstall the JRE? Has anyone heard of this before? Thanks!!

    You could try installing the Java 1.4 plugin.
    http://java.sun.com/getjava/

  • Share safari bookmarks but not browsing history

    In iCloud, how do I share safari bookmarks but not browsing history?

    Thanks for replying. Private browsing doesn't save either type of history, so it wouldn't make a difference.
    I don't want my browsing history available when Firefox is open. I sometimes leave the browser open for days at a time if I haven't turned my computer off.

  • Applet work well in appletviewer but do not work within browser

    hi, i created an applet that works well in appletviewer,but it does not work within a firefox browser, it issue a message: java.security.AccessControlException: access denied (java.io.FilePermission imgDir/vsam.jpg read). What can i do to solve this issue please ?

    sign the applet, use doprivileged and trust the applet when you open it.
    Use htmlconverter in jdk/bin folder to convert you applet so it uses
    object tag instead of applet so IE won't try to run it with msjvm.
    Signing applets:
    http://forum.java.sun.com/thread.jsp?forum=63&thread=524815
    second post and reply 18 for the java class file using doprivileged
    Still problems?
    A Full trace might help us out:
    http://forum.java.sun.com/thread.jspa?threadID=656028

  • Eclipse applet viewer works but not browser

    With the code below, my problem is that I am able to get the applet to work in eclipse but unable to get it to work in a regular IE browser. I tried various different ways of getting the path name. The code goes through printing **File name :edu/vt/vbi/pathport/client/plugin/pathinfo/pathinfo.xsl with the classloader being not null. However, it seems that the problem occurs when trying to get the url and then getting the input stream. myClassLoader.getResource(xslFileName); seems to be returning null according to the browser console but is retrieved okay by eclipse. any help would be much appreciated. thanks in advance.
    String clsName = this.getClass().getName();
    int lastDot = clsName.lastIndexOf('.');
    String pkgName = clsName.substring(0, lastDot);
    String xslFileName = pkgName.replace('.', '/');
    xslFileName = xslFileName + "/pathinfo.xsl";
    System.out.println("**File name :" + xslFileName);
    ClassLoader myClassLoader = Thread.currentThread()
                             .getContextClassLoader();
    URL url = null;
    if (myClassLoader == null) {
              System.out.println("classloader is null");
    } else {
         url = myClassLoader.getResource(xslFileName);
    //InputStream is = myClassLoader.getResourceAsStream(xslFileName);
    InputStream is = null;
    try {
         if (url != null){
         System.out.println("url is " + url);
         is = url.openStream();
    } catch (IOException e) {
         System.out.println("url null");
         e.printStackTrace();
    if (is == null) {
         System.out.println("resource not found");
    Transformer transformer = tFactory
                             .newTransformer(new javax.xml.transform.stream.StreamSource(
                                       is));

    problem solved... jar path required extra / in order to be recognized. thanks

  • Can see in appletviewer but not in browser

    Hy,
    I am trying to display a text on JTextArea using the code below. In appletviewer this is OK but I can not see the text on browser (IE 6, NS 8, Firefox 1.0.7). The browser only show a retangle applet. No exceptions.
    If I insert this two lines
    output = " \nHy";
    outputArea.append( output );
    then I can see "Hy" but not the text in mytext.txt. Why?
    Thanks
    Flow
    import java.io.*;
    import java.awt.Container;
    import javax.swing.*;
    public class myClass extends JApplet {
         public void init() {
              JTextArea outputArea = new JTextArea();
              outputArea.setLineWrap(true);
                 outputArea.setWrapStyleWord(true);
                 outputArea.setEditable (false);
              Container container = getContentPane();
              container.add( new JScrollPane( outputArea ) );
              String output = "";
              String file = "mytext.txt";
              try {
                   BufferedReader bufR = new BufferedReader(new FileReader(file));
                   String s = null;
                   while ((s = bufR.readLine()) != null) {
                        output += s;
                   bufR.close();
              } catch (Exception e) {
                   e.printStackTrace();
              outputArea.setText(output);
    <html>
    <head>
    <title>Untitled Document</title>
    </head>
    <body>
              <applet code="myClass.class" width="300" height="80"></applet>
    </body>
    </html>

    in your Java Console, while runnig your applet on browser you'll se...
    Java Plug-in 1.5.0_04
    Usar versi�n JRE 1.5.0_04 Java HotSpot(TM) Client VM
    Directorio local del usuario = C:\Documents and Settings\mbaiges
    java.security.AccessControlException: access denied (java.io.FilePermission mytext.txt 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 java.io.FileInputStream.<init>(Unknown Source)
         at java.io.FileInputStream.<init>(Unknown Source)
         at java.io.FileReader.<init>(Unknown Source)
         at myClass.init(myClass.java:24)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)That's because an applet needs to be a "signed applet" to have the requested privileges to access to local files, such as your "mytext.txt".
    There are many topics related to this problem that will help you to solve it :-)

  • Clear classloader when exit applet, but not browser

    Hi there,
    I've got some problems with the classloader.
    when i start my applet with the language de, it will correctly name the buttons etc. in german.
    in my site it is possible to change the language. after clicking on another lanuage, my applet
    restarts with the correct parameters (language=en), but the buttons and so on are still named in
    german.
    i figured out, that after clearing the classloader cache, the language is the correct one.
    how can i clear the classloader cache when i leave the applet, but not the browser?
    thanks in advance!

    Hi there,
    I've got some problems with the classloader.
    when i start my applet with the language de, it will correctly name the buttons etc. in german.
    in my site it is possible to change the language. after clicking on another lanuage, my applet
    restarts with the correct parameters (language=en), but the buttons and so on are still named in
    german.
    i figured out, that after clearing the classloader cache, the language is the correct one.
    how can i clear the classloader cache when i leave the applet, but not the browser?
    thanks in advance!

  • Applet work with JRE 7_51 but NOT with JRE 7_45

    Hello,
    My major problem is, that my Applet signed with COMODO certificate DOES NOT WORK with JRE 7_45.
    The SAME applet works fine with JRE 7_45, if I sign this applet WITH A SELFMADE UNTRUSTED certificate.
    WHY the comodo signed applet doesn't run in JRE 7_45 ???
    If i launch the comodo signed applet with JRE 7_51 it works perfect !!!
    But in our company we got JRE 7_45 and I have to deal with JRE 7_45. That’s my problem.
    Could you please tell me a solution what I have to do that the comodo signed applet works also in JRE 7_45.
    Thank you!
    Philipp

    Thanks gimbal2.
    I agree the problem may be in the proxy or in the firewall but I don' to know how to prove it as if i call the servlet url from browser I dont have problems .
    The version im using is 6.45 but im sure the same problem occurs also with other versions of JRE6 .
    ... and the problem disappear with JRE7 ...
    trouble is my company want people to use JRE6
    any idea ?
    Gio

  • AS3 Components dissappear from stage when viewed in HTML but not in Flash Player app

    I'm really hoping someone can help me here. I've been working
    on a project for a while now (still very new to AS but I'm getting
    there) and am supposed to be showing an initial release tomorrow. I
    have a main app (Application.swf) that contains all the business
    logic classes. Application.swf then loads Skin.swf which contains
    all of the GUI widgets & design. The idea is that Skin.swf can
    be swapped out for Skin2.swf and customized if desired.
    Skin.swf contains 2 AS3 components: ComboBox & DataGrid
    When I test Application.swf the components appear and work
    fine. When I double click Application.swf and open it in Flash
    Player.app (standalone flash player from Adobe) the components
    appear & work fine. When I export to HTML and view
    Application.swf in a browser page the components are both
    completely missing. Not that they are present but have no data,
    they are just completely absent from the stage.
    I can't figure out how this could be the case unless maybe
    there is a security setting somewhere that's triggered by the .swf
    running in a browser.
    Any help would be HUGELY appreciated.
    Thanks,
    Cliff

    Figured it out. Change wmode to opaque. I just wasted hours
    on this retarded bug.

  • Playing on viewer is fine but not on output

    I play timeline and out put to vcr to record my project. The canvuas show playing but not on output. It freezes. I read other people that happen to them. I try to reset canvas fit to window but it still happen freeze again. Is there anyway other to reset? I have project that are due.

    It would help to know what format(s) you're working with and how you're outputting from FCP. Do you have a card (ie AJA/Kona) or just using Firewire with DV25?
    Many things can cause playback problems, among them are:
    Canvas and Viewer window set larger than "Fit to Window"
    Too many overlays turned on; Image+Wireframe, Title Safe, Excess Luma, etc.
    Any of FCP's windows overlapping - even slightly
    Any of FCP's windows partially off screen
    Items in Timeline not fully rendered
    Playback quality set incorrectly
    -DH

  • Applet behaves differently in appletviewer and Web Browser, how to resolve?

    I have an applet application which need to access disk files. While I set the .java.policy file properly and the applet runs excellent in appletviewer. However, if I load the applet in Web broswer (e.g. NetScape), the applet cannot access the same disk files as it does in appletviewer?
    Does anyone have a clue on how to resolve?
    Thank you.

    I know you can do it with JavaScript, and I know how to do that...but this is a Java forum (I want a Java solution, that's why I post it here)!
    Therefore my question relates to Java, and in this case, it's an applet.
    Any solution to my problem, please?

  • Air play gives audio from itunes (sometimes) but not browser

    Apple TV used to work fine from all devices on all apps/browsers.  Now I get video but not audio from my Firefox browser via Air Play & if the settings are just right then I can get audio from iTunes ONLY.  HELP!

    UPDATE:
    Well, the nice folks at AJA were kind enough to send another card out.
    It just arrived today. I swapped it out with the older card, and then -  - - - - the problems still persist.
    The computer revved up into turbo mode, and there are still a few glitchy things happening with some basic functions in OSX. (I even did a re-install before putting the new card in).
    Checked / updated the firmware / etc.
    Starting to think this is a MAC issue, but dont' know how to proceed.
    Thanks so much for the help already, but I'd sure love to see this problem resolved once and for all somehow...
    Ideas?

Maybe you are looking for