Results 1 to 8 of 8
  1. #1
    Join Date
    May 2011
    Location
    Maryland
    Posts
    38
    Rep Power
    0

    Default Running a java program without eclipse / JAR Files?

    I've created a java-based version of monopoly in eclipse for my computer science class that has tons of classes and images. I know how to use it in eclipse but i was wondering how to run it on another computer that doesn't have eclipse so that a friend could run it on their computer. Someone mentioned something about a JAR file, but I wasn't sure how to create one of those or if this was the right thing to do? Can anyone help?

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    If you created a jar file with all the class files and a manifest file, you can pass that jar file to anyone with a JRE installed and it should execute.
    Read the JDK doc for the jar command. jar comes with the JDK.
    Also do a search on the forum for examples of jar command usages.

    Also look at using Eclipse to create the jar file.

  3. #3
    Join Date
    May 2011
    Location
    Maryland
    Posts
    38
    Rep Power
    0

    Default

    thanks, i've been looking at them a little but i'm getting a little confused as to how i create on in the first place after seeing things like
    Create jar file
    jar c[v0M]f jarfile [-C dir] inputfiles [-Joption]
    jar c[v0]mf manifest jarfile [-C dir] inputfiles [-Joption]
    jar c[v0M] [-C dir] inputfiles [-Joption]
    jar c[v0]m manifest [-C dir] inputfiles [-Joption]
    on oracle..

  4. #4
    Join Date
    May 2011
    Location
    Maryland
    Posts
    38
    Rep Power
    0

    Default

    Actually i was able to create one using eclipse but now when trying to run it ive gotten this error...any idea what to do?
    Failed to load Main-Class manifest attribute from C:\....

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

    Default

    Quote Originally Posted by littledrummerboy View Post
    Actually i was able to create one using eclipse but now when trying to run it ive gotten this error...any idea what to do?
    You told the Eclipse jar wizard where it could find the file to be used for the manifest entry of your .jar file; the manifest file isn't there. Or (alternatively) you didn't put in a manifest entry in your .jar file at all. Check your .jar file with a zip utility and see what's in there.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  6. #6
    Join Date
    May 2011
    Location
    Maryland
    Posts
    38
    Rep Power
    0

    Default

    You were right, I was missing a manifest entry, it works perfectly now, thanks a lot!

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    If your problem is solved, please mark this thread as "solved" using the Thread Tools at the top.

  8. #8
    Join Date
    May 2011
    Location
    Maryland
    Posts
    38
    Rep Power
    0

Similar Threads

  1. Running as Java Applet in eclipse
    By atomant in forum New To Java
    Replies: 0
    Last Post: 12-05-2010, 02:22 AM
  2. Running EXE files with Java
    By linuxrockers in forum New To Java
    Replies: 2
    Last Post: 03-23-2010, 06:10 PM
  3. Creating and running Java .ini files
    By Camzie in forum NetBeans
    Replies: 4
    Last Post: 11-25-2009, 12:42 PM
  4. Replies: 1
    Last Post: 05-06-2009, 06:43 PM
  5. Running batch files in java
    By pradeesh in forum New To Java
    Replies: 10
    Last Post: 12-04-2008, 09:26 PM

Posting Permissions

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