Page 1 of 2 12 LastLast
Results 1 to 20 of 21
  1. #1
    Delinitor is offline Super n00b
    Join Date
    Jun 2012
    Location
    The Internetz
    Posts
    17
    Rep Power
    0

    Unhappy Eclipse Exporting

    I apologise in advance for my being a total noob.


    I've created a really basic game using Slick2D using Eclipse, and it functions perfectly when I run it inside the IDE. My friend wants to give it a go. So, I tried the whole 'File>Export' shabang, and it seemed fine.

    Until I tried to run the damn thing. It just doesn't run. So I Googled it, but I couldn't find a solution to what was going wrong. Hopefully you guys can help me.

    Thankyou!

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,655
    Blog Entries
    7
    Rep Power
    21

    Default Re: Eclipse Exporting

    Did you add a manifest entry (containing the main class name of your application) and does your jar file contain all the resources (images etc.) it needs?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Delinitor is offline Super n00b
    Join Date
    Jun 2012
    Location
    The Internetz
    Posts
    17
    Rep Power
    0

    Default Re: Eclipse Exporting

    I didn't, how would I go about doing so?

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,655
    Blog Entries
    7
    Rep Power
    21

    Default Re: Eclipse Exporting

    Quote Originally Posted by Delinitor View Post
    I didn't, how would I go about doing so?
    First create a small text file containing at least the following line:

    Java Code:
    Main-Class: <the full name of your main class>
    Next export all your cass files and resources and specify a manifest entry in Eclipse's wizard using your small text file.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    Delinitor is offline Super n00b
    Join Date
    Jun 2012
    Location
    The Internetz
    Posts
    17
    Rep Power
    0

    Default Re: Eclipse Exporting

    It says "Could not find the main class: Game.Game" D:

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,655
    Blog Entries
    7
    Rep Power
    21

    Default Re: Eclipse Exporting

    Quote Originally Posted by Delinitor View Post
    It says "Could not find the main class: Game.Game" D:
    Well, you didn't create your jar file correcty then. There are tutorials that teach you how to create a comple jar and Eclipse has extensive help too.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    Delinitor is offline Super n00b
    Join Date
    Jun 2012
    Location
    The Internetz
    Posts
    17
    Rep Power
    0

    Default Re: Eclipse Exporting

    I can't think how I could have created the jar file incorrectly :/ I'll keep trying, thanks for your help man :)
    Last edited by Delinitor; 06-18-2012 at 11:17 PM.

  8. #8
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: Eclipse Exporting

    How are you exporting exactly? Did you try Export->Runnable Jar File?

  9. #9
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: Eclipse Exporting

    Moved from New to Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  10. #10
    Delinitor is offline Super n00b
    Join Date
    Jun 2012
    Location
    The Internetz
    Posts
    17
    Rep Power
    0

    Default Re: Eclipse Exporting

    Yeah, I've tried using a manifest and I've tried using cmd, and I just can't think what I'm doing wrong D:

    And, sorry about the forum misplacement :P

  11. #11
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,655
    Blog Entries
    7
    Rep Power
    21

    Default Re: Eclipse Exporting

    Right click on your project; select Export ... > Jar file > Next; select all the files you want to export and specify the name of your .jar file; click Next; select export with compile warnings; click next; select Use exiting manifest from workspace; specify the text file to be used for the manifest entry; click Finish.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  12. #12
    Delinitor is offline Super n00b
    Join Date
    Jun 2012
    Location
    The Internetz
    Posts
    17
    Rep Power
    0

    Default Re: Eclipse Exporting

    Again, "Could not find the main class Game.Game. Program will exit."

    I have a feeling that I might have done the manifest incorrectly; what should I be writing exactly? At the moment I have:

    Main-Class: Game.Game

    Is this wrong?

  13. #13
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: Eclipse Exporting

    How do we know?
    That is based entirely on the full class name of the class containing the main() method (which means the package name and the class name).
    SO if your Game class has a main() method, and is in a package called Game, then that would be correct.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  14. #14
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,655
    Blog Entries
    7
    Rep Power
    21

    Default Re: Eclipse Exporting

    Quote Originally Posted by Tolls View Post
    How do we know?
    That is based entirely on the full class name of the class containing the main() method (which means the package name and the class name).
    SO if your Game class has a main() method, and is in a package called Game, then that would be correct.
    ... and it should be stored in that .jar file ;-)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  15. #15
    Delinitor is offline Super n00b
    Join Date
    Jun 2012
    Location
    The Internetz
    Posts
    17
    Rep Power
    0

    Default Re: Eclipse Exporting

    Right, the package is called Game. The class within that package that contains the main() class is also called Game. Every time I export and attempt to run the JAR file, it says that the main() class cannot be found.
    Last edited by Delinitor; 06-19-2012 at 07:59 PM.

  16. #16
    Delinitor is offline Super n00b
    Join Date
    Jun 2012
    Location
    The Internetz
    Posts
    17
    Rep Power
    0

    Default Re: Eclipse Exporting

    So, no ideas?

  17. #17
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,655
    Blog Entries
    7
    Rep Power
    21

    Default Re: Eclipse Exporting

    Quote Originally Posted by Delinitor View Post
    So, no ideas?
    One more idea: does that single line in your manifest file end with an end-of-line?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  18. #18
    Delinitor is offline Super n00b
    Join Date
    Jun 2012
    Location
    The Internetz
    Posts
    17
    Rep Power
    0

    Default Re: Eclipse Exporting

    ... What's an end-of-line? Haha

  19. #19
    Delinitor is offline Super n00b
    Join Date
    Jun 2012
    Location
    The Internetz
    Posts
    17
    Rep Power
    0

    Default Re: Eclipse Exporting

    Ah-ha! I tried to run it through cmd, and recieved this:

    C:\TakeFlight>java -jar TakeFlight.jar
    Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoa der.main(JarRsrcLoa
    der.java:58)
    Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at org.lwjgl.Sys$1.run(Sys.java:73)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
    at org.lwjgl.Sys.loadLibrary(Sys.java:95)
    at org.lwjgl.Sys.<clinit>(Sys.java:112)
    at org.lwjgl.opengl.Display.<clinit>(Display.java:132 )
    at org.newdawn.slick.AppGameContainer$1.run(AppGameCo ntainer.java:39)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.newdawn.slick.AppGameContainer.<clinit>(AppGam eContainer.java:36)

    at Game.Game.main(Game.java:28)
    ... 5 more



    It looks as though I don't have the lwjgl in the jar ...

  20. #20
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,655
    Blog Entries
    7
    Rep Power
    21

    Default Re: Eclipse Exporting

    Wouldn't it be nice if you told us why all of a sudden your main class could be found?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Page 1 of 2 12 LastLast

Similar Threads

  1. Exporting with Eclipse
    By DrHax in forum Eclipse
    Replies: 0
    Last Post: 02-12-2012, 01:09 PM
  2. Problems exporting as JAR in eclipse
    By meesterpickles in forum Eclipse
    Replies: 0
    Last Post: 01-16-2012, 05:44 PM
  3. Exporting to an Excutable Jar
    By KeyLay in forum New To Java
    Replies: 16
    Last Post: 11-29-2011, 02:24 AM
  4. Problem when exporting to CSV
    By deepusrp in forum New To Java
    Replies: 10
    Last Post: 06-26-2009, 09:33 AM
  5. Exporting my project
    By Nim in forum CLDC and MIDP
    Replies: 3
    Last Post: 11-04-2008, 11:53 AM

Tags for this Thread

Posting Permissions

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