Problems making a Jar

Turning a memory game writtin in eclipse to a jar

Page 1 of 1

9 Replies - 672 Views - Last Post: 12 March 2009 - 07:13 PM Rate Topic: -----

#1 handle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 01-February 09

Problems making a Jar

Posted 11 March 2009 - 09:28 PM

Hi,

For our last school project we had to make a memory game, now that it's done I wanted to send it to a friend or two so they could try it out. I figured I'd just make it into a jar, but my photos used for the memory game(card face, image under card) don't show up when I run the jar. Is this a coding problem, or am I doing something wrong with the jar creation.

P.S. The images work fine when I run it in Eclipse.

Thanks.
Is This A Good Question/Topic? 0
  • +

Replies To: Problems making a Jar

#2 no2pencil  Icon User is offline

  • Head MFIC
  • member icon

Reputation: 5068
  • View blog
  • Posts: 26,450
  • Joined: 10-May 07

Re: Problems making a Jar

Posted 11 March 2009 - 09:31 PM

Anyway you can post the syntax from when you tried to make it?
Was This Post Helpful? 0
  • +
  • -

#3 handle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 01-February 09

Re: Problems making a Jar

Posted 11 March 2009 - 09:48 PM

Not entirely sure what you mean, from the Jar creation? I just used the eclipse built in jar creator. I'm exporting the generated class files and resources, the source files and resources, I'm not sure what else would be helpful. The program works in the Jar, it's just there are no pictures. Not sure what would be helpful to state, never done this before.
Was This Post Helpful? 0
  • +
  • -

#4 BigAnt  Icon User is offline

  • May Your Swords Stay Sharp
  • member icon

Reputation: 101
  • View blog
  • Posts: 2,392
  • Joined: 16-August 08

Re: Problems making a Jar

Posted 12 March 2009 - 07:36 AM

Are you putting the pictures in the Jar file or are there in an external path. If they are in an external path then you need to specify the class-path in the jar's manifest. Eclipse had a glitch in which it sometimes confused class paths when generating manifests, not sure if it still does, so you will have to manually type the manifest and give it to Eclipse.
Was This Post Helpful? 0
  • +
  • -

#5 MatzoMeal  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 19-January 09

Re: Problems making a Jar

Posted 12 March 2009 - 11:10 AM

http://www.goldenstu...maker/index.php

you can try this, it works well for me
Was This Post Helpful? 0
  • +
  • -

#6 BigAnt  Icon User is offline

  • May Your Swords Stay Sharp
  • member icon

Reputation: 101
  • View blog
  • Posts: 2,392
  • Joined: 16-August 08

Re: Problems making a Jar

Posted 12 March 2009 - 11:24 AM

It will probably be easier to make the jar at Command line

Here is the sun tutorial:

http://java.sun.com/...ar/downman.html
Was This Post Helpful? 0
  • +
  • -

#7 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2556
  • View blog
  • Posts: 10,664
  • Joined: 20-September 08

Re: Problems making a Jar

Posted 12 March 2009 - 02:34 PM

How are the images being loaded? Please post the code
Was This Post Helpful? 0
  • +
  • -

#8 BigAnt  Icon User is offline

  • May Your Swords Stay Sharp
  • member icon

Reputation: 101
  • View blog
  • Posts: 2,392
  • Joined: 16-August 08

Re: Problems making a Jar

Posted 12 March 2009 - 03:04 PM

Quote

Are you putting the pictures in the Jar file or are there in an external path. If they are in an external path then you need to specify the class-path in the jar's manifest. Eclipse had a glitch in which it sometimes confused class paths when generating manifests, not sure if it still does, so you will have to manually type the manifest and give it to Eclipse.


Actually this is for the images not Java files, you just need to make sure the images are in the correct place that the program is looking at when they are loaded.
Was This Post Helpful? 0
  • +
  • -

#9 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8315
  • View blog
  • Posts: 31,836
  • Joined: 06-March 08

Re: Problems making a Jar

Posted 12 March 2009 - 06:38 PM

Did you just copy the images into your directory ?
In that case Eclipse won't know about them.
So when you Jar it will only take the Java class created within Eclipse

You have to import the image using the Eclipse import file system command so that Eclipse metada will know that the image files are part of the project

As BigAnt suggested, and this is what I personnaly do, just Jar from the command line... it will include all the directory and sub directories without problem
Was This Post Helpful? 0
  • +
  • -

#10 handle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 01-February 09

Re: Problems making a Jar

Posted 12 March 2009 - 07:13 PM

Thanks for the tips, I'll give it a try.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1