Trouble exporting .jar file [message #898984] |
Mon, 30 July 2012 01:53 |
Nigel Cunliffe Messages: 2 Registered: July 2012 |
Junior Member |
|
|
Hi. In the process of learning Java I have mainly been making very simple programs. But now I actually have a project, still in progress, that I am very proud of so far. Anyways I would like to export it as a JAR file(its a game), but I seem to be failing to do so. What I do is, File> Export> JAR file.
I choose a name and location for the jar (same folder as src, images, etc). I then choose "Generate manifest file" and choose my main class and hit finish. I would upload some screenshots but I can't on this forum for some reason.
I get a popup saying "JAR export finished without warnings" and everything seems good. But when I try to run it, I get this error: "Could not find the main class: (class name) Program will exit"
I have searched a few forums with people having the same problem, but none of their solutions have seemed to work for me (or I am just doing something wrong). One thing I read is that it could be something with the Environment Variables path. I am aware of how to edit it, but I am not exactly sure what I would need to change (or if it even really matters). The program I am trying to export also uses images and reads info from a txt file. Not really sure if thats a big deal either. Also uses no external libraries or anything like that, just pure Java.
I have also tried exporting is as a "Runnable JAR" but I get the same error after getting the same confirmation that it compiled fine. Also, I think I should add that running the JAR or Runnable JAR through command line works fine, but I would really like to be able to distribute this to others. Also Im using Eclipse Indigo and running JDK7/JRE7
As you can probably tell I am a total n00b and if anyone can walk me through what I should do in the simplest possible way, I would really really appreciate it. Thanks people! =)
|
|
|
Re: Trouble exporting .jar file [message #899064 is a reply to message #898984] |
Mon, 30 July 2012 12:22 |
Dani Megert Messages: 3802 Registered: July 2009 |
Senior Member |
|
|
On 30.07.2012 03:53, Nigel Cunliffe wrote:
> Hi. In the process of learning Java I have mainly been making very
> simple programs. But now I actually have a project, still in progress,
> that I am very proud of so far. Anyways I would like to export it as a
> JAR file(its a game), but I seem to be failing to do so. What I do is,
> File> Export> JAR file.
>
> I choose a name and location for the jar (same folder as src, images,
> etc). I then choose "Generate manifest file" and choose my main class
> and hit finish. I would upload some screenshots but I can't on this
> forum for some reason.
>
> I get a popup saying "JAR export finished without warnings" and
> everything seems good. But when I try to run it, I get this error:
> "Could not find the main class: (class name) Program will exit"
Make sure to run it with java[w] -jar <your JAR>
Dani
> I have searched a few forums with people having the same problem, but
> none of their solutions have seemed to work for me (or I am just doing
> something wrong). One thing I read is that it could be something with
> the Environment Variables path. I am aware of how to edit it, but I am
> not exactly sure what I would need to change (or if it even really
> matters). The program I am trying to export also uses images and reads
> info from a txt file. Not really sure if thats a big deal either. Also
> uses no external libraries or anything like that, just pure Java.
>
> I have also tried exporting is as a "Runnable JAR" but I get the same
> error after getting the same confirmation that it compiled fine. Also,
> I think I should add that running the JAR or Runnable JAR through
> command line works fine, but I would really like to be able to
> distribute this to others. Also Im using Eclipse Indigo and running
> JDK7/JRE7
>
> As you can probably tell I am a total n00b and if anyone can walk me
> through what I should do in the simplest possible way, I would really
> really appreciate it. Thanks people! =)
|
|
|
|
Powered by
FUDForum. Page generated in 0.09278 seconds