CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2009
    Posts
    3

    Post Java beginner cannot find embeded applet

    Hello,

    I have been learning Java and I have a working Hello World app that I can make work from the command prompt. I see

    Hello World!

    My problem comes to when I embed the program into a webpage. My HTML is all sound...

    <applet code="helloworld.class" width=300 height=300>
    <param name="bgcolor" value="ffffff">
    <param name="fontcolor" value="000000">
    Your browser is not Java enabled.
    </applet>

    My .html and .class files are both in the same directory on the website.

    But my applet produces the following error...

    load: class helloworld.class not found.
    java.lang.ClassNotFoundException: helloworld.class
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed:http://www.webtest.frihost.org/helloworld/class.class
    at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    ... 7 more
    Exception: java.lang.ClassNotFoundException: helloworld.class

    Does anyone know what the problem might be? I have trawled the net for answers and not fornd an answer as of yet

    Neilos

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Java beginner cannot find embeded applet

    Do you think the 'caused by' message in the stack trace might contain a clue?

    Caused by: java.io.IOException: open HTTP connection failed:http://www.webtest.frihost.org/helloworld/class.class

    We don't have time to stop for gas, we're already late...
    M. Cleron
    Please use &#91;CODE]...your code here...&#91;/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  3. #3
    Join Date
    Jul 2009
    Posts
    3

    Re: Java beginner cannot find embeded applet

    Quote Originally Posted by dlorde View Post
    Do you think the 'caused by' message in the stack trace might contain a clue?

    Caused by: java.io.IOException: open HTTP connection failed:http://www.webtest.frihost.org/helloworld/class.class
    Yes, I had notices this but couldn't understand why the JRE would want to open a file called class.class in the subdirectory helloworld/... when I don't put that in the applet 'code' element...

    code="helloworld.class"

    Can anyone see why it is looking there for the file? I cannot see why it would or how to point it at the right place (as far as I'm aware it should be pointed at the correct file).

    Thanks

    Neilos

  4. #4
    Join Date
    Jul 2009
    Posts
    3

    Re: Java beginner cannot find embeded applet

    Bump!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured