• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 625
  • Last Modified:

Creating a jar with JApplet not executing

Hi,

I am using eclipse to write my application and I am having trouble getting my jar file to work. I have had some success with the jar file working when the main class is set to a JFrame, but as soon as I set the main class to a JApplet and export the program as a jar the file will not run - I double click on it and nothing happens!

I have also tried the cmd version of compiling a jar and I get the same results.
I follow these instructions - http://csdl.ics.hawaii.edu/~johnson/613f99/modules/04/jar-files.html

Do I need to do something different for a jar that runs as an applet?

Also I was googleing and I found JBuilder - is this for building java applets? If so is it free and should I use it?

Thanks,

waffe  
0
waffe
Asked:
waffe
  • 3
  • 3
  • 2
  • +3
5 Solutions
 
Mayank SAssociate Director - Product EngineeringCommented:
Does the JFrame have a main () method? The JApplet won't be having it. Its supposed to run in an HTML under a browser, for example.
0
 
hoomanvCommented:
> Also I was googleing and I found JBuilder - is this for building java applets? If so is it free and should I use it?
Borland JBuilder is a Java IDE (Integrated Development Environment) like eclipse
it automates the creation and deployments of applications applets midlets servlets etc
0
 
CEHJCommented:
You can't run an applet in a jar by doubling clicking it under normal circumstances. The jar file must be used in the applet tag in an html page as its archive attribute

e.g.


<applet codebase="." code="a.b.c.YourApplet" archive="your.jar" width="300" height="300">
</applet>
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
waffeAuthor Commented:
What is code="a.b.c.YourApplet" supposed to be?
0
 
hoomanvCommented:
YourApplet class resides in package a.b.c
0
 
hoomanvCommented:
means that YourApplet.class file should be loaded from directory a/b/c (directory hierarchy)
0
 
waffeAuthor Commented:
O' - it is the class that has the main method in it?
0
 
objectsCommented:
> but as soon as I set the main class to a JApplet

your main class should still be the class that contains main, which would open a JFrame

> Do I need to do something different for a jar that runs as an applet?

No, you can have both the application and  applet in the same jar.
When double clicked the main would get run, and when run from a web page the applet would get loaded.

0
 
ksivananthCommented:
Nope, it is the class which extends JApplet!

BTW, JBuilder is not free as eclipse!
0
 
Mayank SAssociate Director - Product EngineeringCommented:
>> O' - it is the class that has the main method in it?

Like I said before - the applet need not have a main () method. You will typically load it in a web-browser through an HTML page or something which has an <applet> tag as CEHJ has shown.
0
 
waffeAuthor Commented:
Ok - I think I have it now, and a new problem has arrived which you will probably see posted here  :)

Thanks all,

waffe
0
 
CEHJCommented:
:-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now