Results 1 to 13 of 13
  1. #1
    Atriamax is offline Member
    Join Date
    Sep 2009
    Posts
    41
    Rep Power
    0

    Default Opening applet with .html file

    I want to create a local .html file to open up my applet using a web browser,
    and i cant seem to figure out its done. I copied and pasted the html code with
    </applet> or whatever and all that stuff but its doesnt work, how do i do it?

  2. #2
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

    Default

    read it, the use of applet tag if your java applet is correct
    Deploying Applets (The Java™ Tutorials > Deployment > Applets)

    remember, you need to set the width, height attributes in the applet tag

  3. #3
    Atriamax is offline Member
    Join Date
    Sep 2009
    Posts
    41
    Rep Power
    0

    Default

    how do i run it? i used textedit and saved the file as a html but when i open it safari just shows me the code as text on the browser? i want to be able to click on a html file and open the applet.

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    You didn't read the link suggested above, did you?

  5. #5
    lipun4u is offline Member
    Join Date
    Jul 2009
    Location
    bhubaneswar
    Posts
    5
    Rep Power
    0

    Default

    let's assume the class file name of ur applet code is SimpleApplet.

    here is the html file that execute that applet

    Java Code:
    <applet code="SimpleApplet" width=200 height=100>
    </apple>

  6. #6
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    </apple> ?

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

  8. #8
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    haha, I was wondering what r\d+x was talking about. Now I see it.
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  9. #9
    Atriamax is offline Member
    Join Date
    Sep 2009
    Posts
    41
    Rep Power
    0

    Default

    blegh i understand all the code n stuff i just dont know how to run it. nothing tells me where i type that code

  10. #10
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    Did you typed the code correctly, have java installed and enabled on safari? Did you follow the link and read the instructions?

    attached in a class file and an html file that works on IE.
    Attached Files Attached Files
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  11. #11
    Atriamax is offline Member
    Join Date
    Sep 2009
    Posts
    41
    Rep Power
    0

    Default

    yeah works perfectly, as long with other applets, but whenever i open mine it just shows the text i typed in the file

  12. #12
    Atriamax is offline Member
    Join Date
    Sep 2009
    Posts
    41
    Rep Power
    0

    Default

    k and i just noticed when i open yours as a text file it displays the text thats in your applet the "you Should see an applet below"

    edit
    k i looked at the Textedit prefences and theres a bunch of different option for saving in html.

    it gives 4 different document types, 4.01 HTML strict, 4.01 HTML transitional, XHTML 1.0 strict and XTHML 4.01 strict.
    it gives 3 different styling: embedded cSS, inline CSS and no CSS
    then it gives encoding, which just seems like differnent languages and such any ideas?

    Edit Edit
    HA i got it to work, i had to turn it off rich text format, sheesh
    applet doesnt run but i got the little X symbol which excited me,
    ill prolly get it running in the next 10 min
    thanks for your help guys :)
    Last edited by Atriamax; 09-13-2009 at 06:04 AM.

  13. #13
    Atriamax is offline Member
    Join Date
    Sep 2009
    Posts
    41
    Rep Power
    0

    Default

    got the applet working, but its not loading my sounds and images, they are in the same directory and the been using getCodeBase() but it doesnt load them.
    (its been working in eclipse, just not once it goes on the browser)
    any suggestions?
    it wasnt working, so i looked at that link again and got
    java.sun. com/docs/books/tutorial/deployment/applet/data .html
    (which was exactly what i was doing before i looked it up)

Similar Threads

  1. Opening a custom proyect file
    By janpol1 in forum Eclipse
    Replies: 0
    Last Post: 02-04-2009, 02:29 PM
  2. Opening file, runs in NetBeans but CommandPrompt
    By fauzilhaqqi in forum NetBeans
    Replies: 2
    Last Post: 12-15-2008, 03:48 AM
  3. How can I include a html file in html textarea?
    By surya_dks in forum New To Java
    Replies: 2
    Last Post: 10-04-2008, 07:20 AM
  4. Java Applet HTML
    By ownlol in forum Java Applets
    Replies: 4
    Last Post: 07-21-2008, 02:59 AM
  5. Problem in opening a file
    By Raghav kv in forum New To Java
    Replies: 1
    Last Post: 08-11-2007, 01:55 PM

Posting Permissions

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