Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Can't get my .jar file to work
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
HellblazerX




PostPosted: Tue Jul 04, 2006 11:17 am   Post subject: Can't get my .jar file to work

I'm trying to make a self-executable jar file, but when I try to run it, it keeps giving me the error "Cannot find main class. Program will exit". It doesn't make sense why the error keeps popping up. I have all the classes in the jar file, and I made a manifest file that sets the main class as Game, which is in the jar file, and I have the extra line at the bottom. I've even tried using rizzix's manifest maker program, but that doesn't work either. Can anyone help me with this?
Sponsor
Sponsor
Sponsor
sponsor
rizzix




PostPosted: Wed Jul 05, 2006 12:12 pm   Post subject: (No subject)

What exactly is the problem? What error do you get?
HellblazerX




PostPosted: Wed Jul 05, 2006 3:48 pm   Post subject: (No subject)

The error just says, "Could not find main class. Program will exit".
[Gandalf]




PostPosted: Wed Jul 05, 2006 6:17 pm   Post subject: (No subject)

If you haven't already, try putting the manifest file in a folder within the jar file called "META-INF". Also, make sure that the manifest file is called "MANIFEST.MF".
HellblazerX




PostPosted: Wed Jul 05, 2006 8:14 pm   Post subject: (No subject)

That's just the thing. Everything is where it's supposed to be. When I extract out the files in the jar file to see if I had everything right, I did. The manifest file was called MANIFEST.MF, and it's in a folder called META-INF. I think it might be where my classes are located. They're in a folder called "Wolfenstein3D", which is inside another folder called "c". Is that the right folder it's supposed to be in? And, also, how do I place files back into the jar file?
[Gandalf]




PostPosted: Wed Jul 05, 2006 8:19 pm   Post subject: (No subject)

When you specify the main class in the manifest file, you have to give it information enough to find that class. If that main class isn't located at the top level of the jar file, then you must specify the path to locate it (ie. Wolf3D/mainClass).

You can open and manipulate jar files just like any other archive, for example with WinRar you can replace the files inside the archive without extracting it first.
HellblazerX




PostPosted: Wed Jul 05, 2006 8:33 pm   Post subject: (No subject)

Woot! It worked! Thanks so much Gandalf! I'd post this executable version, but I'd be going over the upload limit, and I'm not sure if people still want to look at the source code or not.
[Gandalf]




PostPosted: Wed Jul 05, 2006 8:48 pm   Post subject: (No subject)

No problem. In return for helping me out with my GUI problem, which I still have to try out. Smile

If you need more upload space, just ask an admin and they'll probably give you a few more MB. Only keep in mind that the FP forum is now locked, so you won't be able to update the file there.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: