• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 13
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!??? .


 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lolo,Welcome to java ranch.........

Do you want to invoke a applet which is bundled in a jar file?
 
Lolo Mohammed
Greenhorn
Posts: 13
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lolo,
Go through the link,webpage.
It might help you.
 
Lolo Mohammed
Greenhorn
Posts: 13
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your replay

but it did'nt work. the problem is in specifing the main class..
 
Ankit Tripathi
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lolo,
Can you further elaborate your problem with relevant code snippets.
It would be easier to help you.
 
Lolo Mohammed
Greenhorn
Posts: 13
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you show me what is written in your manifest file??
 
Ankit Tripathi
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Villains always have antidotes. They're funny that way. Here's an antidote disguised as a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic