• 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

beating head on desk, I hate jars

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I start out that I've got:
sfolder/Soccer.class as the main class file
myManifest.mf has "Main-Class: sfolder.Soccer" included at the end with a line break
jar -cvmf myManifest.mf soccer.jar sfolder
that makes the jar file and everything's happy but it just won't run, the main class cannot be found
Am I doing something stupid or does it just really hate me?
also....
can a text file in the jar file be edited by one of the classes in the jar?
[ February 17, 2004: Message edited by: Rick Gentry ]
[ February 17, 2004: Message edited by: Rick Gentry ]
 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you run jar -xf soccer.jar,
change to the META-INF directory, and look at the MANIFEST.MF file, what does your Main-Class attribute look like?
Also, how are you invoking the jar file? (Remember, you have to include the -jar switch, so your command line should look like: java -jar soccer.jar)
 
Rick Gentry
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm double clicking and running from command line. /shrug No difference, they both can't find the file.
Manifest-Version: 1.0
Created-By: 1.4.2_01 (Sun Microsystems Inc.)
Main-Class: sfolder.Soccer
//empty line here
//and here
I've also tried it so that it return this format:
Manifest-Version: 1.0
Class-Path: sfolder
Created-By: 1.4.2_01 (Sun Microsystems Inc.)
Main-Class: Soccer
//two blank lines
I don't know what the blank lines are and I really don't know what I'm doing wrong as I've done this once before without this much difficulty.
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
myManifest.mf has "Main-Class: sfolder.Soccer" included at the end with a line break
Try "Main-Class: sfolder/Soccer" instead. That should do the trick.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also remember to "add" a enter after the Main class.
As I know that it cannot be run if you omit the "last enter".
From
samhome
 
Rick Gentry
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sam Leung:
Also remember to "add" a enter after the Main class.
As I know that it cannot be run if you omit the "last enter".
From
samhome


I already have a "last enter". I already said that.
Also it doesn't like "sfolder/Soccer" either.
 
Rick Gentry
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Manifest-Version: 1.0
Created-By: 1.4.0_02 (Sun Microsystems Inc.)
Main-Class: Soccer
Class-Path: sfolder/
"/"! Ah, that's better. You'd think that whoever had made the manifest class would have thought to check for stupid stuff like that and fix it automatically.
 
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I create excutable jars and never put the classpath in it and they work just fine. I;m not sure why you think you have to add it nor why it seems to not work without it for you. Here is one of my manifests:

brian
 
reply
    Bookmark Topic Watch Topic
  • New Topic