Results 1 to 9 of 9

Thread: main class could not be found?

  1. #1

    Thread Starter
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    main class could not be found?

    I've created a jar file like this:

    jar cfmv Manifest.mf RoboPlot.jar RoboPlot.class ImagePlotter.class

    The manifest.mf file looks like this:


    Main-Class:RoboPlot

    For some reason, when I use this command to run it,
    java -jar RoboPlot.jar

    it tells me that the main class could not be found

    I also tried this:

    Manifest-Version: 1.0
    Created-By: 1.5.0 (Sun Microsystems Inc.)
    Main-Class:RoboPlot

    and it didn't work either.

  2. #2
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Re: main class could not be found?

    Do you have any packages involved? The syntax to set the applications entry point is correct. Main-Class: classname. If your class is in a package then the manifest file should read Main-Class: MyPackage.MyClass and creation of the jar archive jar cmf Manifest.txt MyJar.jar MyPackage/*.class.

  3. #3

    Thread Starter
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: main class could not be found?

    No, there are no packages involved...That is of course excluding swing,awt, and that stuff. That may be the problem; do you think I need to put all my classes in a package and then call that main class from that package in the statement declaring the main class?

  4. #4

  5. #5
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Re: main class could not be found?

    Also the default manifest just contains this information such as version and who created it ie...Manifest-Version: 1.0, Created-By: 1.5.0_01 (Sun Microsystems Inc.). I think when you want to add additional information to the manifest you have to prepare a .txt file containing the information that you want to add to the manifest. That's what the m option if for. It seems like you are aware of that since you included the m option but shouldn't it be jar cfmv Manifest.txt RoboPlot.jar RoboPlot.class ImagePlotter.class?

  6. #6

    Thread Starter
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: main class could not be found?

    Now I'm getting a invalid header field I/O exception...It gives me the same error when I run it using the Manifest.mf file too...So, what's wrong with the header?

    By the way, why aren't you moding the Java forum anymore?

  7. #7

  8. #8
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Re: main class could not be found?

    Posted by System_Error

    By the way, why aren't you moding the Java forum anymore?
    Ive been having some problems at home. What is comes down to is that im 31 and still live at home but i don't feel so bad about it since three out of four of my friends that ive know since high school still live home. The area i live in is probably the most expensive area in the united states. My fourth friend scott is only able to rent the first floor of a two family house because his girlfriend is an accountant and makes good money. Anyway my dad told me i had to get out, my friend daves mom told him he had to get out and my friend seans parents told him that hes got to get out soon. So it was either i move to las vegas with my friend dave whos been buggin me to go or move to TN where my xgirlfriend now lives. I think im going go with the latter cause i can just transfer over my credits from community college to the Universisty of Tennessee. So i decided to stop moderating the Java forum cause when i move which is probaby in a week im not going to be able to be on the boards that much until i get everything togther down there.

  9. #9

    Thread Starter
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: main class could not be found?

    Quote Originally Posted by Dilenger4
    Ive been having some problems at home. What is comes down to is that im 31 and still live at home but i don't feel so bad about it since three out of four of my friends that ive know since high school still live home. The area i live in is probably the most expensive area in the united states. My fourth friend scott is only able to rent the first floor of a two family house because his girlfriend is an accountant and makes good money. Anyway my dad told me i had to get out, my friend daves mom told him he had to get out and my friend seans parents told him that hes got to get out soon. So it was either i move to las vegas with my friend dave whos been buggin me to go or move to knoxville tenessee where my xgirlfriend now lives. I think im going go with the latter cause i can just transfer over my credits from community college to the Universisty of Tennessee. So i decided to stop moderating the Java forum cause when i move which is probaby in a week im not going to be able to be on the boards that much until i get everything togther down there.
    Well, at least your still here, at first I thought you had left for good The good thing about knoxville, is you only live like two hours away from me! Transfering from community colleges usually work out nice, I know my brother did it and had no problems. Also, you might like getting out on your own, and I don't see why you live at home, because you seem like a really smart person and could have a nice job.

Posting Permissions

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



Click Here to Expand Forum to Full Width