Results 1 to 2 of 2
  1. #1
    x2robbie2x is offline Member
    Join Date
    Feb 2010
    Rep Power

    Default Jar file error. Please help!

    Hey I'm not that new to Java, but recently I've been looking into how to create a jar file. I have the manifest and the program I'm trying to convert to .jar is only a main class, no other additional classes are included. It is compiled and the manifest is where it's supposed to be, but when I click on the jar file I get a error that says:

    Could not find the main class: *****. Program will exit.

    Could anyone help me and tell me what I'm doing wrong?

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Rep Power


    likely, you are not invoking the jar command with the "m" option to specify "use this manifest file I have here" . without telling jar to use your own manifesst, creating a jar file of a folder structure that includes the META-INF/MANIFEST.MF file right there in the folder, the jar command will quite irritatingly just hapily go and create its own default manifest file in the jar, which would not have your Main-Class property that is needed here.

    To verify this is the case, create the jar, then create some temporary folder, and extract the jar into this spot, and look at the manifest file.

    So try invoking jar like:
    Java Code:
    jar cmf manifest ExecutableJar.jar application-dir
    See also: JAR files revealed

Similar Threads

  1. Replies: 6
    Last Post: 02-10-2011, 09:55 AM
  2. Error during file open
    By in forum Advanced Java
    Replies: 1
    Last Post: 10-14-2008, 02:26 PM
  3. File upload error
    By jegadeeshsp in forum Advanced Java
    Replies: 2
    Last Post: 08-20-2008, 05:13 AM
  4. reading from a zip file, error
    By Mr tuition in forum AWT / Swing
    Replies: 1
    Last Post: 01-16-2008, 12:39 AM
  5. File Write Error
    By vikain in forum Advanced Java
    Replies: 5
    Last Post: 01-02-2008, 04:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts