File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes How to run a .jar in a browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "How to run a .jar in a browser" Watch "How to run a .jar in a browser" New topic
Author

How to run a .jar in a browser

Connor Advent
Greenhorn

Joined: Jun 03, 2011
Posts: 4
I have a .jar that runs just fine on its own in Windows with JRE.

I am trying to get it to run on my website. The HTML code is the following:



What am I supposed to put for the .class? I only have .jar and I have no idea what class I am supposed to use. I have very little Java experience. How can I accomplish this?

Thank you,
Connor Advent
Greenhorn

Joined: Jun 03, 2011
Posts: 4
Bump.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39543
    
  27
What do you mean by "runs just fine" - are you double-clicking the jar file on your desktop? If so, it's an application, not an applet. Unless the jar file also contains an applet class, there's no way to get it to work in a browser as is.


Ping & DNS - updated with new look and Ping home screen widget
Connor Advent
Greenhorn

Joined: Jun 03, 2011
Posts: 4
Thank you for the reply!

When I double click the .jar in Windows it does open, yes. However, in the root directory of the .jar there is an applet class and a bunch of folders.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39543
    
  27
if there is, in fact, an applet class, then its name should go into the "code" attribute.
Connor Advent
Greenhorn

Joined: Jun 03, 2011
Posts: 4
Never mind I think I was mistaken. The file in the root of the .jar is called java.policy.applet. I am assuming this isn't what you meant since this is all it contains:



This means then it must be an application. Is there any way I can make this an applet?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39543
    
  27
The http://www.acme.com/resources/classes/Acme/ApplicationApplet.java class does that to a certain degree.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to run a .jar in a browser
 
Similar Threads
How To Read a JAR from another JAR??
how to run applets classes ?
class file in jar works when invoked on local machine, but gets "class not found" when run from web
Deploying an Applet.
Problem when calling applet