This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Applets and the fly likes Executable Jar file: Not working after being embedded within a html page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Executable Jar file: Not working after being embedded within a html page?" Watch "Executable Jar file: Not working after being embedded within a html page?" New topic
Author

Executable Jar file: Not working after being embedded within a html page?

Kieran Shoo
Greenhorn

Joined: Nov 19, 2009
Posts: 3
Hello, I have a small problem with my applet when embedding within a html page.

The applet works fine when ran as a Jar Executable, yet when embedded into html (Even after being signed) it throws this error...



The applet itself downloads files from an address to be loaded later from another program, without having to re-download everytime someone decides to use the other program. As stated before, running as an executable jar works perfectly fine. The applet is signed, and here is the source of a test html page to display the applet:



I don't believe there are any errors, the code will execute perfectly via executable jar or from the classes using a batch file.

Thanks for your time,
~Kieran
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41141
    
  45
The applet works fine when ran as a Jar Executable, yet when embedded into html (Even after being signed) it throws this error...

An executable jar file depends on there being a class having a main method. An applet works rather differently - it needs to extend the Applet (or JApplet) class - does your FileDownloader class do that?


Ping & DNS - my free Android networking tools app
Kieran Shoo
Greenhorn

Joined: Nov 19, 2009
Posts: 3
Ulf Dittmer wrote:
The applet works fine when ran as a Jar Executable, yet when embedded into html (Even after being signed) it throws this error...

An executable jar file depends on there being a class having a main method. An applet works rather differently - it needs to extend the Applet (or JApplet) class - does your FileDownloader class do that?


I've fixed this now - thanks alot
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

It's not exactly a problem that your class has a main method. But when the browser goes to run your applet, it isn't going to call that main method. It wants to call some other methods, and that's where the problem arises. You should have a look at the Applet Tutorial to see what you should be doing instead.
Kieran Shoo
Greenhorn

Joined: Nov 19, 2009
Posts: 3
Ahh so instead of the main method I should be using the initialize method.

Thanks alot, i'll test to see if it works just now.
~Kieran

-Edit-

Alright, I replaced



With



However it still throws an error upon running the applet...

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Executable Jar file: Not working after being embedded within a html page?
 
Similar Threads
Applet throwing exception when running it through web browser
Applet InvocationTargetException
Applet to upload files with SCP to
Problem running Applet
can not access a member of class docupop with modifiers problem