Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Saving Java Applets - Halfway there...

  • 18-12-2004 9:05pm
    #1
    Registered Users, Registered Users 2 Posts: 3,357 ✭✭✭


    Hey,
    I found a website that has loads of cool java applets, and I'd like to be able to run them offline. If I save it as a fave 'offline', the page loads, but not the applet. If I choose Save As, the same thing happens. I've tried going into the temp internet files, put I can't see any .jar files
    How would I run such JARs anyways?
    Are java applets saved in a different file format?

    I've tried doing this in Firefox and IE.

    Any other ways to save these applets?


Comments

  • Registered Users, Registered Users 2 Posts: 307 ✭✭Thordon


    Try looking for .class files, you could run them in applet viewer, or write simple html pages to run them:

    <html><head></head>
    <body>
    <applet code="TheClassFile.class" width="100" height="100"></applet>
    </body>
    </html>

    If you cant find them in the cache, try linking directly to them in the address bar like www.thesite.com/TheApplet.jar, they might be in the same folder as the html/jsp/whatever files.

    Edit: Actually, if you save the pages, then open up the .html file in notepad/another text editor, then look for the applet or object tag, you could find the path to the .jar or .class file.


  • Closed Accounts Posts: 36,634 ✭✭✭✭Ruu_Old


    maybe "View Source" of the page the applet is on, see where its located and throw the url into a download manager, im sure theres an easier way :)


  • Registered Users, Registered Users 2 Posts: 3,357 ✭✭✭snappieT


    Ruu wrote:
    maybe "View Source" of the page the applet is on, see where its located and throw the url into a download manager, im sure theres an easier way :)
    I tried that, cheers anyway


  • Closed Accounts Posts: 920 ✭✭✭elvis2002


    you cant run applets offline, its a security feature for your own good. What you are looking for is .class files!, These files are the compiled java code. You can get the code if you wish be reverse enginerring the code using a decompiler such as DJ Decompiler.

    If you have java nstalled though, all you have to do is locate the .class file for an applet. Go into Dos and type appletviewer myJavaFile
    That should open the applet in a window for you.


  • Registered Users, Registered Users 2 Posts: 3,357 ✭✭✭snappieT


    Cheers for that Thordon and Elvis

    What would be an applet viewer btw?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 307 ✭✭Thordon


    The applet viewer comes with java, I just checked, and it seems it only comes with the JDK, not the the JRE, so if you dont have it, you need to go to java.sun.com and get the JDK.

    Linky: https://jsecom16d.sun.com/ECom/EComActionServlet/LegalPage:~:com.sun.sunit.sdlc.content.LegalWebPageInfo;jsessionid=E60781D1938B5AF58A6232545A3BCEEB;jsessionid=E60781D1938B5AF58A6232545A3BCEEB


  • Closed Accounts Posts: 920 ✭✭✭elvis2002


    yah, you need the developers kit Im afraid. Its big too. appletviewer is simply a tool that comes with the development kit that lets you run applets from a command prompt without having to encapsulate them inside a html page first. Its extremely useful.


  • Registered Users, Registered Users 2 Posts: 3,357 ✭✭✭snappieT


    I did a HDD search for al class files and the most recent are over 3 months old, while I have an applet open in front of me right now.
    Help!


  • Closed Accounts Posts: 920 ✭✭✭elvis2002


    are you sure its not a Flash prog your looking at? *.swf if you are


  • Registered Users, Registered Users 2 Posts: 3,357 ✭✭✭snappieT


    Its definantly java. Take http://www.phy.syr.edu/courses/ijmp_c/Ising.class for example


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    Paste a link.


  • Closed Accounts Posts: 920 ✭✭✭elvis2002


    Are u downloading the complete web page or just the html. ? Try using ie for downloading the complete web page. Firefox doesnt seem to do it.


  • Registered Users, Registered Users 2 Posts: 3,357 ✭✭✭snappieT


    I couldn't care less about the html. I just want to be able to run the Applet, if at all possible.

    Wow i sounded bossy, sorry


  • Registered Users, Registered Users 2 Posts: 3,357 ✭✭✭snappieT


    Giblet wrote:
    Paste a link.
    Here ya go: http://www.phy.syr.edu/courses/ijmp_c/Ising.html


  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    Unzip to the same folder, and run the html file.


  • Registered Users, Registered Users 2 Posts: 3,357 ✭✭✭snappieT


    That rules giblet.
    Would you mind awfully telling me how to do it myself?

    If you like u can use ICQ 219497090


    Thank u so much


  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    I ran the first class, read the errors to see what was missing. Got all except one doing that.
    Then I tried changing your link from .html to .java

    It worked, read the file, and got the final class.

    :D


  • Registered Users, Registered Users 2 Posts: 3,357 ✭✭✭snappieT


    So you had to download each of the class files seperately from the server?

    Take into account that I will have over 300 of them offline...
    Is there any easier way than guesswork?

    I've just tried it again now. It works if you just have the HTML and lsingsimulation.class
    You don't need the rest


  • Registered Users, Registered Users 2 Posts: 3,357 ✭✭✭snappieT


    I'm taking another example from here:
    http://www.cs.utah.edu/~zachary/isp/applets/Cannon/Cannon.html

    I've downloaded cannon.class, and put in in a folder with this html file:
    *****************************************************************
    <html>
    <head>
    <title>Lets Test</title></head>
    <body>
    <h1> Testing... </h2>

    <applet code=Cannon.class align=middle width=340 height=300

    ></applet>

    </body>
    </html>
    ****************************************************************

    A red cross comes up in the applet area.
    I went into the java console, and the following read:

    ****************************************************************


    Java Plug-in 1.5.0
    Using JRE version 1.5.0 Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\Stephen


    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
    p: reload proxy configuration
    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>

    java.lang.NoClassDefFoundError: Cannon (wrong name: Cannon/Cannon)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadCode(Unknown Source)
    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)
    ****************************************************************

    Any help would be much appreciated. From anyone


  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet




  • Advertisement
  • Registered Users, Registered Users 2 Posts: 3,357 ✭✭✭snappieT


    Giblet wrote:
    Ooh, thanks. Will that method work for every Java Applet?

    Edit: I just realised that way won't work if the actual html file is called index.html (which it often is)
    Any other possible way, or is there a program that can do it for me?


Advertisement