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 Problem when make .jar file from my java applet program!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Problem when make .jar file from my java applet program!!!" Watch "Problem when make .jar file from my java applet program!!!" New topic
Author

Problem when make .jar file from my java applet program!!!

Lolo Mohammed
Greenhorn

Joined: Mar 17, 2011
Posts: 13

Hay,

I have a java applet program, and since it does not have a main class i got error when i try to run the .jar file.

I add this line to manifest.mf file:

Main-Class: Pakagename.mainclassname

but it give me error and said that fatal exception occured, program will exit

and whe i write only the class name:
Main-Class: mainclassname

he saied that he could not find the mainclassname

How can i fix that!!??? .


Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
Hi Lolo,Welcome to java ranch.........

Do you want to invoke a applet which is bundled in a jar file?
Lolo Mohammed
Greenhorn

Joined: Mar 17, 2011
Posts: 13

hay,

Yes i need to invoke an applet, and also to use it in my web site.

I think the problem is in the manifest.mf

my program do not have a main method in the main class it use inti() insted of main(), so when he try to run the applet he could not find the main method.

what should i do??
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
Hi Lolo,
Go through the link,webpage.
It might help you.
Lolo Mohammed
Greenhorn

Joined: Mar 17, 2011
Posts: 13

Thank you for your replay

but it did'nt work. the problem is in specifing the main class..
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
Hi Lolo,
Can you further elaborate your problem with relevant code snippets.
It would be easier to help you.
Lolo Mohammed
Greenhorn

Joined: Mar 17, 2011
Posts: 13

How to make .jar file for my java applet program??

i follow this
http://drupal.org/node/742110

but it does not work and give me this error:

C:\Users\LooOOooly\Documents\NetBeansProjects\OthelloEE\src\OthelloGame>jar cvfm OthelloEE.jar *.class mainclass.txt
java.io.IOException: invalid header field
at java.util.jar.Attributes.read(Attributes.java:389)
at java.util.jar.Manifest.read(Manifest.java:182)
at java.util.jar.Manifest.(Manifest.java:52)
at sun.tools.jar.Main.run(Main.java:132)
at sun.tools.jar.Main.main(Main.java:1022)


Please help me
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
Lolo,really sorry for a late reply,but example given in link provided by me worked fine for me according to your requirements.I wonder how it is troubling you.Have you checked your menifest file against a standard format,having all required headers?
Lolo Mohammed
Greenhorn

Joined: Mar 17, 2011
Posts: 13

Can you show me what is written in your manifest file??
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
Hi Lolo,sorry once again for a late reply,found myself in some typical family situation... My Menifest file is given below Menifest-Version:1.0 Name:MyAppletClass.class Class-Path:MyAppletClass here Class-Path header is a replacement for Main-Class, working in condition you have defined a main class(having main method) for your archive,working as a entry point for the navigation of archive.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42274
    
  64
You'll find everything there is to know about packaging applications in jar files at http://download.oracle.com/javase/tutorial/deployment/jar/index.html


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem when make .jar file from my java applet program!!!