Applet not starting in web browser

I'm trying to get a "hello world" applet to work in a web page. I can compile it with javac and run the resulting clas with java just fine. System, Windows XP Pro SP1, Netscape 7.1, Java SDK J2RE1.4.2_05.
Any help is greatly appreciated!
Thanks,
Mark
Following are the java source, html and errors.
welcome1.java
public class welcome1 {
public static void main( String args[])
int x=1;
while(x <=10)
System.out.println("Welcome to java programming! " + x);
x++;
page.html
<html>
<body>
<applet code="welcome1.class" width="300" height="100">
</applet>
</body>
</html>
Errors
bottom of web browser
Applet welcome1 notinited
In Java Console
java.lang.ClassCastException
     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)

An applet class is slightly different from an application class. Better take a look at
http://java.sun.com/developer/onlineTraining/Programming/BasicJava1/applet.html

Similar Messages

  • Swing components in applet not working in web browser

    Hi Guys,
    I've created an applet which makes use of some swing components, but unfortunately, not all of them function properly in my web browser (internet explorer or Mozilla Firefox). Its mainly the buttons; the last buttons works and displays the correct file within the broswer, but the first 5 buttons do not work...
    any help please on how I can sort this problem out?
    Heres the code for my applet:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.applet.*;
    public class MainAppWindow extends JApplet
    int gapBetweenButtons = 5;
    final JPanel displayPanel = new JPanel(new BorderLayout());
    public void init()
       //Panel for overall display in applet window.
       JPanel mainPanel = new JPanel(new BorderLayout());
       mainPanel.add(new JLabel(new ImageIcon(getClass().getResource("images/smalllogo2.gif"))),BorderLayout.NORTH);
       //sub mainPanel which holds all mainPanels together.
       JPanel holdingPanel = new JPanel(new BorderLayout());
       //Panel for displaying all slide show and applications in.
       displayPanel.setBackground(Color.white);
       displayPanel.add(new JLabel(new ImageIcon(getClass().getResource("images/IntroPage.jpg"))),BorderLayout.CENTER);
       displayPanel.setPreferredSize(new Dimension(590,400));
       JPanel buttonPanel = new JPanel(new GridLayout(6,1,0,gapBetweenButtons));
       buttonPanel.setBackground(Color.white);
       JButton button1 = new JButton("User guide");
       button1.addActionListener(
         new ActionListener() {
              public void actionPerformed(ActionEvent e)
                   if(displayPanel.getComponents().length > 0)displayPanel.removeAll(); // If there are any components in the mainPanel, remove them and then add label
                   displayPanel.setBackground(Color.white);
                   displayPanel.add(new JLabel(new ImageIcon("images/UserGuide.jpg")));
                   displayPanel.revalidate(); // Validates displayPanel to allow changes to occur onto it, allowing to add different number images/applicaions to it.
       JButton button2 = new JButton("What is a Stack?");
       button2.addActionListener(
       new ActionListener() {
               public void actionPerformed(ActionEvent e)
                   if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
                   displayPanel.setBackground(Color.white);
                   displayPanel.add(new JLabel(new ImageIcon("images/WhatIsAStack.jpg")));
                   displayPanel.revalidate();
       JButton button3 = new JButton("STACK(ADT)");
       button3.addActionListener(
       new ActionListener() {
             public void actionPerformed(ActionEvent e)
                   if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
                   displayPanel.setBackground(Color.white);
                   displayPanel.add(new JLabel(new ImageIcon("images/StackADT.jpg")));
                   displayPanel.revalidate();
       JButton button4 = new JButton("Stacks in the Real World");
       button4.addActionListener(
       new ActionListener() {
             public void actionPerformed(ActionEvent e)
                   if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
                   displayPanel.setBackground(Color.white);
                   displayPanel.add(new JLabel(new ImageIcon("images/StacksInTheRealWorld.jpg")));
                   displayPanel.revalidate();
       JButton button5 = new JButton("DEMONSTRATION");
       button5.addActionListener(
       new ActionListener() {
             public void actionPerformed(ActionEvent e)
                 if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
                 Demonstration app = new Demonstration();
                 JPanel appPanel = app.createComponents();//gets the created components from Demonstration application.
                 appPanel.setBackground(Color.pink);
               displayPanel.add(appPanel);
               displayPanel.revalidate();
       JButton button6 = new JButton("Towers Of Hanoi");
       button6.addActionListener(
       new ActionListener() {
             public void actionPerformed(ActionEvent e)
                     if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
                     TowerOfHanoi app = new TowerOfHanoi();
                     JPanel appPanel = app.createComponents();//gets the created components from Towers of Hanoi
                     JPanel mainPanel = new JPanel();//panel used to centralise the application in center
                     mainPanel.add(appPanel);
                     mainPanel.setBackground(Color.pink); //sets mainPanel's background color for 'Towers Of Hanoi'
                     displayPanel.add(mainPanel);
                     displayPanel.revalidate();
       //adding buttons to the buttonPanel.
       buttonPanel.add(button1);
       buttonPanel.add(button2);
       buttonPanel.add(button3);
       buttonPanel.add(button4);
       buttonPanel.add(button5);
       buttonPanel.add(button6);
       JPanel p = new JPanel(); // Used so that the buttons maintain their default shape
       p.setBackground(Color.white);
       p.add(buttonPanel);
       holdingPanel.add(p,BorderLayout.WEST);
       holdingPanel.add(displayPanel,BorderLayout.CENTER);
       //Positioning of holdingPanel in mainPanel.
       mainPanel.add(holdingPanel,BorderLayout.CENTER);
       //indent mainPanel so that its not touching the applet window frame.
       mainPanel.setBorder(BorderFactory.createEmptyBorder(10,20,10,20));
       mainPanel.setBackground(Color.white);
       mainPanel.setPreferredSize(new Dimension(850,600)); //size of applet window
       mainPanel.setOpaque(false); // Needed for Applet
       this.setContentPane(mainPanel);
    }

    Thanks for the response. I don't quite understand what you're talking about though. I have, in my humble knowledge, done nothing with packages. I have put the applet class (WiaRekenToolActiz.class is the applet class) in the jar file wia_actiz_archive.jar. From what I read on the tutorial, java looks for the applet class in all the jar files specified. Since I put my CODEBASE as the main url, I thought it baiscally didn't matter where you out the html file.
    I shall include the complete html page complete with applet tag to perhaps illuminate a bit more what I mean...
    <html>
    <head>
    <title>Wia Rekenmodule hello!</title>
    </head>
    <body bgcolor="#C0C0C0">
    <applet
    CODEBASE= "http://www.creativemathsolutions.nl/test"
    ARCHIVE= "Actiz/wia_actiz_archive.jar, Generic/wia_archive.jar"
    CODE="WiaRekenToolActiz.class" 
    WIDTH=915 HEIGHT=555
    >
    <PARAM NAME = naam VALUE = "Piet Janssen">
    <PARAM NAME = gebdag VALUE = "01">
    <PARAM NAME = gebmaand VALUE = "06">
    <PARAM NAME = gebjaar VALUE = "1970">
    <PARAM NAME = geslacht VALUE = "man">
    <PARAM NAME = dienstjaren VALUE = "10">
    <PARAM NAME = salaris VALUE = "56500">
    <PARAM NAME = deeltijdpercentage VALUE = "100">
    <PARAM NAME = accountnaam VALUE = "Zorginstelling 'De Zonnebloem'">
    </applet>
    </body>
    </html>

  • Is it possible to start a web browser from with xterm (X11)?

    Hello,
    Would it be possible to start a web browser from xterm? I am able to use for example, dbca or netca. But I want to know if I could start a web brower in my xterm. Thank you.

    Thank you. Firefox was not found on this redhat linux, I am guessing it was not installed. I did a find / -name firefox but not finding it. I don't think the SA installed GUI on this box. Is there a browser I can use even though GUI was not installed? That is why I am attempting to use xterm hoping to be able to access a brower in xterm. I am using Xming for xterm. Is there something in Xming I can use so I can access the Oracle Database Control Console? I can use firefox from my desktop but the port is block at the firewall and the SA would not open the port due to security reasons. Thank you.

  • Edge Code will not load in web browser

    My OEM edge code will not load in web browser after it has been uploaded to the server. I am using dreamweaver & the OEM file.
    The images are all grouped & labeled properly (within Edge Animate). Note the website will not load with ANY web browsers UNLESS you hit the refresh button or reload the web address.
    www.anndominion.com
    Can somone please tell me what is going on or how to fix the problem? ;(
    Here is the code for the website too.
    Any help would be great!
    <!doctype html>
    <html>
    <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
    <title>Welcome</title>
    <!--Adobe Edge Runtime-->
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <script>
      var custHtmlRoot="edgeanimate_assets/Home/Assets/";
      var script = document.createElement('script');
      script.type= "text/javascript";
    script.src = custHtmlRoot+"edge_includes/edge.5.0.1.min.js";
      var head = document.getElementsByTagName('head')[0], done=false;
      script.onload = script.onreadystatechange = function(){
      if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
      done=true;
      var opts ={
        scaleToFit: "width",
        centerStage: "none",
        minW: "0",
        maxW: "undefined",
        width: "1500px",
        height: "800px"
      opts.htmlRoot =custHtmlRoot;
      AdobeEdge.loadComposition('Home', 'EDGE-292846011', opts,
      {"style":{"${symbolSelector}":{"isStage":"true","rect":["undefined","undefined","1500px", "800px"],"fill":["rgba(255,255,255,1)"]}},"dom":[{"rect":["716px","356","88px","88px","aut o","auto"],"id":"preloader5","fill":["rgba(0,0,0,0)","images/preloader5.gif","0px","0px"], "type":"image","tag":"img"},{"rect":["645px","480px","229px","79px","auto","auto"],"font": ["Arial, Helvetica, sans-serif",[24,""],"rgba(0,0,0,1)","normal","none","","break-word","normal"],"id":"Text" ,"text":"Please Tap Refresh <br>To Load Content.","align":"center","type":"text"},{"rect":["555px","283px","361px","103px","auto" ,"auto"],"font":["Arial, Helvetica, sans-serif",[24,"px"],"rgba(0,0,0,1)","400","none solid rgb(0, 0, 0)","normal","break-word","normal"],"id":"Text2","text":"","align":"center","type":"text" }]}, {"dom":{}});
      script.onload = script.onreadystatechange = null;
      head.removeChild(script);
      head.appendChild(script);
      </script>
    <style>
            .edgeLoad-EDGE-292846011 { visibility:hidden; }
        </style>
    <!--Adobe Edge Runtime End-->
    </head>
      <body>
        <div id="Stage" class="EDGE-292846011"></div>
        </body>
    </html>

    Keith,
    Make sure the Cluster configuration is right. When did you start seeing this problem?
    Host A: Dispatcher->server 0, server 2
    Host B: Dispatcher->server 0, server 2
    i.e The instance IDs are mapped right.
    Also try to hit the individual servers in the cluster the following way.
    http://hostname1:50000/irj/portal;sapj2ee_irj=instance_id sends a request to server 0.
    http://hostname2:51000/irj/portal;sapj2ee_irj=instance_id sends a request to server 1.
    This may give more clues. Unfortunately I don't have access to EP6 SP2 to lookup and tell you the right parameters to look for.
    Regards
    -Venkat Malempati
    Message was edited by: Venkat Malempati

  • I am getting a new computer and it will not have any web browser software preloaded. Can I get a CD with Firefox in order to install?

    I have a new computer that will not have any web browser installed when I acquire it. So, I cannot download Firefox, say, using Internet Explorer. Can I get a copy of Firefox on a CD and use that instead.

    Easiest is to download the full Firefox installer and copy that file to an USB stick.
    http://www.mozilla.com/firefox/all.html
    Such an USB stick is also useful for making backups of your profile data, so if you do not already have one then this is an opportunity to start making backups.
    http://kb.mozillazine.org/Profile_backup and [[Backing up your information]]
    http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox
    http://kb.mozillazine.org/Password_Manager#Backing_up_and_restoring_passwords

  • Kespensky pure does not support my web- browser.

    Iam running a 64 bit Turlon processor in a hp laptop. The operating system is window 7 ultimate. I have recently installed kaspersky Pure ver 9.1.0.124. internet provider is sybeam.
    Since I finally got rid of internet explore using Firefox nothig seems to work. the computer in noticbly slower. and get mesages like The version of :
    "password manager does not support your web-browser
    Reason: TypeError: components_ByID(KPMAUTIFILL_CID) is undefined.
    Also my trash is no longer functioning, the scan doesn't work, and the other small hangups.
    I don't know how you and Kaspersly interface but I would like to get the system bac & running.
    I appreciate your assistance in the matter,
    Thanks,
    John C Trask

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • The changes made in the WAD web template is not replicating on web browser

    Hi,
    We are using BI 7.0 WAD. Suppose if i create a one web template and if i run it ...it is working fine.
    If i change the present web template and if i do change anything on the present web template and if run this web template it is giving the previous result....it is not reflecting the present changes.
    The changes made in the WAD web template is not replicating on web browser result.
    I went to transaction SMICM, then choose "Goto" from the top menu. From there, go to HTTP Server Cache, then choose Invalidate, then choose Global in system. With this thing also it didnt slove.
    thanks

    Clear your browser cache also and see if the changes are visible.....
    Arun

  • Javascript does not work in web browser

    Hello friends.
    I have a problem with javascript in my Captivate project.
    This script only works in preview in Captivate, but does not work in web browser (IE 9, Mozilla, Chrome).
    Anybody knows why?
    Thank you for your answers.

    Common JS interface
    That is the official documentation for JS in Captivate 8. For more information, have a look at Jim Leichliter's website: CaptivateDev.com - eLearning Development with Adobe Captivate

  • I wanted a solution to the problem I was having on Win 7 Pro Service Pack 1 in that links on an open Adobe Acrobat file will not open in my Firefox Browser 33.0.2. The Error I receive is "Acrobat could not run the web browser.  Unknown Error. (123)"

    I want a solution to the problem I was having on Win 7 Pro Service Pack 1 in that links on an open Adobe Acrobat Pro 10.1.12  file will not open in my Firefox Browser 33.0.2. The Error I receive is "Acrobat could not run the web browser.  Unknown Error. (123)"

    Change browsers. See what happens.
    Be well...

  • Links in my email are not opening in web browser. They are bringing the browser up, but not taking me to sites.

    Links in my email are not opening in web browser. They are bringing the browser up, but not taking me to sites. What do I need to do?

    Me too but it's happening on my iMac after I did a software update this morning which included fixes in Mail it said. My Mail was fine before the update!

  • Could not run the web browser

    I've installed Reader 7.0.9 in order to read ebooks. When I try to activate the mobile device, reader responds with "Acrobat could not run the web browser. Unknown error. (0)". Is there a plug-in missing or corrupted control somewhere. Any suggestions. This is XP SP2 (and SP3) on a Dell Precision.
    Any suggestions.

    Let me amend my comment. Reader 7 might have been tested with XP SP2,
    but with all the changes in the OS due to security changes, OS changes
    and browser changes, Reader 8.1.3 or Reader 9 would be a better match to
    your software.
    Mike

  • Changes made in the WAD web template is not replicating on web browser

    Hi,
    We are using BI 7.0 WAD. Suppose if i create a one web template and if i run it ...it is working fine.
    If i change the present web template and if i do change anything on the present web template and if run this web template it is giving the previous result....it is not reflecting the present changes.
    The changes made in the WAD web template is not replicating on web browser result.
    Thanks in adv
    pinky

    Just to add.
    WAD templates are stored as HTML in the HTTP cache.
    Whenever you make changes to the template - it is good practice to delete / invalidate the HTTP Server cache.
    This can be done from
    SMICM --> Goto (menu bar ) --> HTTP Server cache --> Invalidate --> GLobal
    ust to make this thread complete..
    However this is usually done for 3.x web templates since they run off the ABAp stack - not too sure about the JAVA stack - guess portal cache has to be cleared too..

  • Urgent: Could not start the Web Analysis services

    Hello Experts,
    I am having issues when starting Web Analysis Services. Could not start the Web Analysis services
    starting weblogic with Java version:
    java version "1.5.0.07"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0.07-_20_mar_2007_05_31)
    Java HotSpot(TM) Server VM (build 1.5.0.07 jinteg:03.20.07-11:05 IA64, mixed mode)
    Starting WLS with line:
    /opt/java1.5/bin/java -server -Xms256m -Xmx512m -XX:MaxPermSize=128m -Dhyperion.home=/hyphome/Hyperion -DESS_ES_HOME=/hyphome/Hyperion/BIPlus/appsinfo/WebAnalysis/EssbaseJAPI -Datf.session.binding.kill-with-prejudice=true -Dweblogic.j2ee.application.tmpDir=/var/tmp/hyperion -Dcom.sun.xml.namespace.QName.useCompatibleSerialVersionUID=1.0 -da -Dplatform.home=/hyphome/bea/weblogic91 -Dwls.home=/hyphome/bea/weblogic91/server -Dwli.home=/hyphome/bea/weblogic91/integration -Dweblogic.management.discover=false -Dweblogic.management.server=http://localhost:7001 -Dwlw.iterativeDev=false -Dwlw.testConsole=false -Dwlw.logErrorsToConsole= -Dweblogic.ext.dirs=/hyphome/bea/patch_weblogic910/profiles/default/sysext_manifest_classpath -Dweblogic.Name=WebAnalysis -Djava.security.policy=/hyphome/bea/weblogic91/server/lib/weblogic.policy weblogic.Server
    <Jan 6, 2010 12:28:36 PM IST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) Server VM Version 1.5.0.07 jinteg:03.20.07-11:05 IA64 from Hewlett-Packard Company>
    <Jan 6, 2010 12:28:37 PM IST> <Critical> <WebLogicServer> <BEA-000362> <Server failed. Reason:
    There are 1 nested errors:
    weblogic.management.ManagementException: Unable to obtain lock on /hyphome/Hyperion/deployments/WebLogic9/./servers/WebAnalysis/tmp/WebAnalysis.lok. Server may already be running
    at weblogic.management.internal.ServerLocks.getServerLock(ServerLocks.java:159)
    at weblogic.management.internal.ServerLocks.getServerLock(ServerLocks.java:59)
    at weblogic.management.internal.DomainDirectoryService.start(DomainDirectoryService.java:82)
    at weblogic.t3.srvr.ServerServicesManager.startService(ServerServicesManager.java:365)
    at weblogic.t3.srvr.ServerServicesManager.startInStandbyState(ServerServicesManager.java:116)
    at weblogic.t3.srvr.T3Srvr.initializeStandby(T3Srvr.java:630)
    at weblogic.t3.srvr.T3Srvr.startup(T3Srvr.java:402)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361)
    at weblogic.Server.main(Server.java:67)
    >
    <Jan 6, 2010 12:28:37 PM IST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FAILED>
    <Jan 6, 2010 12:28:37 PM IST> <Error> <WebLogicServer> <BEA-000383> <A critical service failed. The server will shut itself down>
    <Jan 6, 2010 12:28:37 PM IST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN>
    Any suggestions would be of great help. Thanks in advance.
    Regards,
    Sudhir
    Edited by: 637223 on Jan 6, 2010 1:54 PM

    Are you sure there is not another web analysis web application process running, have you checked the processes running on the machine, you may have to kill or stop one of them to release the lock.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • After getting a txt message from bell today saying I went over on my data usage , I can not access my web browsing at all... There is no restrictions on my account. But I still can't load safari

    After getting a txt message from bell today saying I went over on my data usage , I can not access my web browsing at all... There is no restrictions on my account. But I still can't load safari... I can still makes calls and send txt messages but I can't send iMessages

    Settings > General > Reset > Reset Network Settings.

  • Applet not running in local browser

    I can run any applet from web.
    I can run any applet in appletviewer.
    But I can not run applets in browser from local html file.
    I can not run even the demos that came with de SDK 1.4.1_01.
    Can anyone give me some hint?
    Maybe is very obvious but I ca not see it.
    Thank you very much.
    Valeriu Sprintu

    the hello.java file is:
    import java.applet.Applet;
    import java.awt.Graphics;
    public class hello extends Applet {
    StringBuffer buffer;
         public void init() {
         public void start() {
         public void stop() {
         public void destroy() {
         public void paint(Graphics g) {
              //Draw a Rectangle around the applet's display area.
              g.drawRect(0, 0, size().width - 1, size().height - 1);
              //Draw the current string inside the rectangle.
              g.drawString("Hello", 5, 15);
    The hello.html file is:
    <html>
    <body>
    Applet should be there
    <br>
    <applet code="hello.class" width=200 height=200>
    No applet
    </applet>
    </body>
    </html>
    hello.html and hello.class are of course in the same folder.
    If I modify the .html file acording to OBJECT tag specifications for Java Plug-In the same applet runs OK in the browser (IE5.0 ).
    I forgot to tell that I have installed the last version of SDK j2sdk1.4.1_01
    <html>
    <body>
    Applet should be there
    <br>
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = 200 HEIGHT = 200 >
    <PARAM NAME = CODE VALUE = "hello.class" >
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.1">
    No applet
    </OBJECT>
    </body>
    </html>
    I think there is a problem with the JVM from Microsoft
    Thank you,
    Best regards,
    ValeriuS

Maybe you are looking for

  • Mail defaulting to wrong account when replying

    I have my wife and my accounts both in Mail. Sometimes, when I do a reply, it defaults as coming from my wife's account instead of mine (even though the message was to me), which is super annoying. The details are this: - message comes addressed to b

  • When I try to use Search function in the keyboard on my iphone while preforming a search via google it will not search

    If i go to googles page type in what i am searching for and then hit the "search" button in the bottom right of my keyboard it does nothing I have updated my iphone to newest OS 5.1.1 and I have rolled it back to a year ago and nothing works. If some

  • How to convert   (pdf raw data) binary to (bitmap/TIFF) image.

    Dear gurus, I'm facing a problem to converting my raw data(binary), which i got from my uploaded PDF file.  I try a few methods from SDN itself to make the raw file can be download to my local PC as images. I already try to download the raw data, dir

  • Freezing After Screen Saver

    My Mac mini is becoming unresponsive and freezing pretty much whenever I return from the screen saver state. The only way I know of getting it out of this state is to turn on my external hard drive then turn it off, but i don't like to do that, CAN Y

  • Event on Drop Down in UI

    Hi All, I need event for Drop Down field in UI, once selected any value then need this event to get trigger?\ my coding is like this in GET_P :   CASE iv_property.     WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype. -> field type: event link