Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Embed a Jar into a website/Exception handling

  1. #1
    Member
    Join Date
    Jan 2011
    Posts
    78
    My Mood
    Confused
    Thanks
    23
    Thanked 1 Time in 1 Post

    Default Embed a Jar into a website/Exception handling

    How can I embed my Jar file into my website?
    K, so I've tried looking up tutorials on how to do this, but everything wants me to use param and stuff or applets (which I don't know how to export in eclipse? (If you could tell me how to make an applet with eclipse that would be cool too)) etc.

    I've tried using this HTML code:
    <APPLET ARCHIVE="C:\Users\User\Desktop\Magic Ball Website\MagicAnswers.jar" WIDTH=200 HEIGHT=50>
    <P>Your Computer Doesn't Know How!<P>
    </APPLET>
    Amongst other things but it wont load at all. (I haven't messed with the size cause it wont load.)
    Also it should be mentioned that this Jar file uses JOption panes that pop out, so I don't know how that would effect it. (Regardless even using a javadoc that doesn't use those it doesn't work).

    Could someone just show me some HTML code that will make this single jar file load (without param's or whatever.. Or teach me what to put for the params. null??) into the webpage? or maybe make an Applet load if you can tell me how to even make it an applet?

    I've uploaded the jar file with the link below. Maybe you can even make some HTML code that will link to that link directly, I'm not sure if it will really work like a hotlink. =/

    Thanks for any help!


    https://docs.google.com/uc?id=0B5QVL...CO2mw_AK&hl=en

    ______________________________________…

    Oh and while I'm at it I might as well ask.. My program keeps giving me this error if I click the cancel button:
    java.lang.NullPointerException ...
    Now from what I understand its because there is not text entered when they do that. I have already assigned values to the variables that it stores your answer to. But.. I'm guessing I have to do exception handling to stop this error from appearing. I've tried adding some exception handling into my code from examples I've seen on the internet but it doesn't know what I'm talking about when I paste it in.. Maybe because I have to import something? or declare and exception handler? I basically don't know how to do exception handling at all.. It's not really a big deal, but on Macintosh computers it actually complains to the user about it, whereas on windows you don't see the error, it just goes anyway. Any light shed on this would also be appreciated.


    And sorry if this is in the wrong section? I wasn't sure where to put it.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Embed a Jar into a website/Exception handling

    Recommended reading: Lesson: Applets (The Java™ Tutorials > Deployment)

    Or if you want to examine source html, I have a few applets up at code.KevinWorkman.com

    And for your NPE, chances are you just aren't handling the case of the cancel correctly. Without seeing any code though, we're just guessing. If you do post any code, make sure it's in the form of an SSCCE.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Embed SWING .JAR in Browser
    By ventrol in forum Java Applets
    Replies: 2
    Last Post: June 9th, 2011, 08:40 PM
  2. Replies: 6
    Last Post: March 25th, 2011, 03:42 PM
  3. Embed xterm in JFrame
    By stu1811 in forum AWT / Java Swing
    Replies: 4
    Last Post: July 28th, 2010, 07:33 AM
  4. Exception handling for TextFields
    By FretDancer69 in forum AWT / Java Swing
    Replies: 1
    Last Post: June 16th, 2009, 07:48 AM
  5. Exception handling
    By AnithaBabu1 in forum Exceptions
    Replies: 6
    Last Post: August 27th, 2008, 09:37 AM