• Post Reply Bookmark Topic Watch Topic
  • New Topic

JAR file: Could not find main class  RSS feed

 
Sarah Riezen
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I'm not sure what section this should go in, so I apologize if it's in the wrong area. I made a really basic, simple program, with only one class in it. I wanted to make it a runnable JAR file, but I can't. In eclipse, it makes the manifest for me and creates the jar, but it still gives me the same error. So I decided to do it manually (which took awhile to figure out), and created a manifest, but it STILL gives me the same error. I've double clicked it, and tried running it in command just incase it makes a difference. I've tried googling it, but every answer I've found has been about missing the manifest, which I have. Any help is appreciated!

Thanks in advanced =)

EDIT:
I tried extracting the files too, to see what's there, and the MANIFEST.MF looks like this:

Manifest-Version: 1.0
Created-By: 1.7.0_01 (Oracle Corporation)
Main-Class: ProfaneOMatic

The return ends here, and that is the main class name, so I don't get wth is wrong.
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sarah Riezen wrote:Hello everyone,

I'm not sure what section this should go in, so I apologize if it's in the wrong area. I made a really basic, simple program, with only one class in it. I wanted to make it a runnable JAR file, but I can't. In eclipse, it makes the manifest for me and creates the jar, but it still gives me the same error. So I decided to do it manually (which took awhile to figure out), and created a manifest, but it STILL gives me the same error. I've double clicked it, and tried running it in command just incase it makes a difference. I've tried googling it, but every answer I've found has been about missing the manifest, which I have. Any help is appreciated!

Thanks in advanced =)

EDIT:
I tried extracting the files too, to see what's there, and the MANIFEST.MF looks like this:

Manifest-Version: 1.0
Created-By: 1.7.0_01 (Oracle Corporation)
Main-Class: ProfaneOMatic

The return ends here, and that is the main class name, so I don't get wth is wrong.


Please TellTheDetails.... We have no idea what's in the jar file. We have no idea what the ProfaneOMatic class looks like (source). We have no idea what is the error that you are encountering. etc. etc. etc.

Henry

 
Sarah Riezen
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:

Please TellTheDetails.... We have no idea what's in the jar file. We have no idea what the ProfaneOMatic class looks like (source). We have no idea what is the error that you are encountering. etc. etc. etc.

Henry



Sorry, I thought that was enough information. I don't know why you'd need to see the source code, and it has alot of profane words in it so I didn't post it. The error is exactly what the title says: "Could not find the main class: ProfaneOMatic. Program will exit." The class with the main method is called, ProfaneOMatic, and I made a manifest file that states this fact.

Either way, I'll post the code. It's probably badly written, but it compiles and runs fine in Eclipse and that's my first beginner's step. Considering I don't want to offend anyone I'll take out the "bad words"



I made the manifest.txt look like this:
Main-Class: ProfaneOMatic


and added a return, since I keep reading that's important.

When I made the jar file, and it didn't run, I tried extracting it to see if the manifest screwed up somehow and it looks like this:

Manifest-Version: 1.0
Created-By: 1.7.0_01 (Oracle Corporation)
Main-Class: ProfaneOMatic



although it's changed to a MANIFEST.MF file, in a META-INF folder.

This is the entire program, no other classes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!