Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
BronYrAur
Jan 25, 2007
This isn't java code related but java related.

I am trying to create a .jar file to package up 3 classes so it can be run by others without having random class files floating around. The issues is the .jar file says "Could not find the main class. Program will exit."

All searches on google point to a manifest problem. However my manifest file is included and correct "Main-Class: GetUserNames" is in there like it should be.

My manifest.mf looks like this:

code:
Manifest-Version: 1.0
Created-By: 1.6.0_07 (Sun Microsystems Inc.)
Main-Class: GetUserNames
There are two carriage returns at the end there that don't seem to copy and paste but they are there.

I'm packaging the jar using command prompt on windows xp. I type the following

code:

jar -cvfm GetUserNames.jar manifest.txt *.class
Any ideas?

Adbot
ADBOT LOVES YOU

BronYrAur
Jan 25, 2007

1337JiveTurkey posted:

Did you fully qualify the name? You can't just say GetUserNames if it's actually com.example.GetUserNames, then you need to add that so it knows what package to look in. If it goes above 70 characters (I think this is the right number), then you should truncate the line at that point and continue on the next, leading with a whitespace. Here's an example created by Ant that I built yesterday:

code:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 1.4.2_15-b02 (Sun Microsystems Inc.)
Built-By: REDACTED
Main-Class: com.REDACTEDREDACTEDREDACTED.document.NewModelCreateDocume
 ntAction
Class-Path: REDACTED.jar REDACTED.jar REDACTED.jar

That's the name of the class file itself. All it contains is the one class with a main method, is there something I am missing with this whole package thing?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply