Results 1 to 7 of 7
Like Tree1Likes
  • 1 Post By Norm

Thread: load uploaded java class using html?

  1. #1
    MarioBrawler is offline Member
    Join Date
    May 2012
    Posts
    18
    Rep Power
    0

    Default load uploaded java class using html?

    Hello, I know hoe to open my java program using the <applet> tag on html, but how do I upload my .class onto a website and open it using html?
    This is the code I have so far
    XML Code:
    <html>
    
      <body>
     
        <applet code="onepiecetest1234.weebly.com/uploads/1/2/3/5/12356816/onepiecelobby.class" width="600" height="400">
        </applet>
      </body>
    </html>
    Thanks

    Edit:I've searched online and read books but they all just show how to do this:
    XML Code:
    <html>
    
      <body>
     
        <applet code="OnePieceLobby.class" width="600" height="400">
        </applet>
      </body>
    </html>
    which works but is now what I wanted.
    Last edited by MarioBrawler; 05-31-2012 at 11:31 PM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: load uploaded java class using html?

    I'm not sure I understand what you are trying to do. Have you read the doc for the definitions of the <APPLET tag's attribute fields? Does the doc say anything like what you are trying to do?

    You can't make things up, you can only do what the doc says the <APPLET tag will do.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    757
    Rep Power
    8

    Default Re: load uploaded java class using html?

    You can use the codebase attribute to tell where the applet class can be found. So you have to configure your applet tag into something like:

    <applet codebase="/uploads/1/2/3/5/12356816/" code="package.SomeApplet"/>
    Last edited by wsaryada; 06-01-2012 at 05:46 AM.

  4. #4
    MarioBrawler is offline Member
    Join Date
    May 2012
    Posts
    18
    Rep Power
    0

    Default Re: load uploaded java class using html?

    Quote Originally Posted by wsaryada View Post
    You can use the codebase attribute to tell where the applet class can be found. So you have to configure your applet tag into something like:

    <applet codebase="/uploads/1/2/3/5/12356816/" code="onepiecelobby.class"/>

    Alright but what happened to the onepiecetest1234.weebly.com/ at the codebase before /uploads/1/2/3/5/12356816/?

    Also, I've done more research and am using this code
    XML Code:
    <html>
    
      <body>
     
        <applet archive="bloonga.com/cizzdm7wk4t8/" code="Lobby.class"width="770" height="560">
        </applet>
      </body>
    </html>
    So this works when I save it in notepad as .html
    But when I try to use the code on a web browser, it doesn't work and returns with this error:
    Java Plug-in 1.6.0_32
    Using JRE version 1.6.0_32-b05 Java HotSpot(TM) Client VM
    User home directory = C:\Users\Aladdin
    ----------------------------------------------------
    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
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    ----------------------------------------------------
    load: class Lobby.class not found.
    java.lang.ClassNotFoundException: Lobby.class
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Un known Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(U nknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Un known Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Un known Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unk nown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unk nown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Exception: java.lang.ClassNotFoundException: Lobby.class

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: load uploaded java class using html?

    class Lobby.class not found.
    The browser/java program is looking for a class named: Lobby.class. That looks like a filename, not a class name. Try removing the .class to get the class name.
    If you don't understand my response, don't ignore it, ask a question.

  6. #6
    MarioBrawler is offline Member
    Join Date
    May 2012
    Posts
    18
    Rep Power
    0

    Default Re: load uploaded java class using html?

    I've tried that
    load: class Lobby not found.
    java.lang.ClassNotFoundException: Lobby
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Un known Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(U nknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Un known Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Un known Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unk nown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unk nown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Exception: java.lang.ClassNotFoundException: Lobby
    Still doesn't seem to work :/ Idk why but it works if I save the code as html on notepad and open it from there.

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: load uploaded java class using html?

    Still doesn't seem to work
    It's not finding the class file.
    If you've found a way that works, use that.
    MarioBrawler likes this.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Replies: 10
    Last Post: 02-02-2012, 08:26 PM
  2. Error: Could not find or load main class Ops.java
    By Javasubbu in forum New To Java
    Replies: 4
    Last Post: 10-05-2011, 10:52 PM
  3. load graphics in html page using jsp and database
    By charu in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 03-04-2009, 07:12 PM
  4. how to load a java class in startup
    By leonard in forum Advanced Java
    Replies: 1
    Last Post: 08-06-2007, 03:36 AM
  5. how to load a html document
    By boy22 in forum Java Servlet
    Replies: 1
    Last Post: 08-05-2007, 04:12 AM

Posting Permissions

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