# .jar problems



## ThatGuy (Jun 2, 2010)

So I wrote this COLL trainer in my programming class. Basically, there are (as of right now) four buttons you can press and they will display an image of a random COLL case of that class(PI, H, etc). You can also press another button to get the algorithm for that case. Right now I'm having trouble creating a .jar file. I can make one that contains the program but not the images. How do I package the images with .jar so I can move the file onto any computer without also moving the image files? Following this site: http://java.sun.com/docs/books/tutorial/deployment/jar/build.html
Here are some errors:


```
C:\Program Files\Java\jdk1.5.0_09\bin>jar cvf P:\Java\Finally\classes\TicTacToe.
jar P:\Java\Finally\classes\Finally.class -C Images .
Images\. : no such file or directory
added manifest
adding: P:/Java/Finally/classes/Finally.class(in = 715) (out= 481)(deflated 32%)
 
C:\Program Files\Java\jdk1.5.0_09\bin>jar cvf P:\Java\Finally\classes\TicTacToe.
jar P:\Java\Finally\classes\Finally.class 1.jpg
1.jpg : no such file or directory
added manifest
adding: P:/Java/Finally/classes/Finally.class(in = 715) (out= 481)(deflated 32%)
 
C:\Program Files\Java\jdk1.5.0_09\bin>jar cvf P:\Java\Finally\classes\TicTacToe.
jar P:\Java\Finally\classes\Finally.class -C Images .
Images\. : no such file or directory
added manifest
adding: P:/Java/Finally/classes/Finally.class(in = 715) (out= 481)(deflated 32%)
 
C:\Program Files\Java\jdk1.5.0_09\bin>jar cvf P:\Java\Finally\classes\TicTacToe.
jar P:\Java\Finally\classes\Finally.class -C Images .
```
 
and my manifest

```
Main-Class: Finally
```
I've put an "Images" folder in where its "supposed" to be.
I'm using JCreator because that's the only one our school lets us use.

EDIT:

```
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\>cd \Finally
C:\Finally>path C:\Program Files\Java\jdk1.5.0_09\bin;%path%
C:\Finally> javac *.java
C:\Finally>echo Main-Class: Finally >manifest.txt
C:\Finally>jar cvfm Finally.jar mainfest.txt *.class Images
java.io.FileNotFoundException: mainfest.txt (The system cannot find the file spe
cified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at java.io.FileInputStream.<init>(FileInputStream.java:66)
        at sun.tools.jar.Main.run(Main.java:122)
        at sun.tools.jar.Main.main(Main.java:903)
C:\Finally> echo Main-Class: Finally >manifest.txt
C:\Finally>jar cvfm Finally.jar mainfest.txt *.class Images
java.io.FileNotFoundException: mainfest.txt (The system cannot find the file spe
cified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at java.io.FileInputStream.<init>(FileInputStream.java:66)
        at sun.tools.jar.Main.run(Main.java:122)
        at sun.tools.jar.Main.main(Main.java:903)
C:\Finally>echo Main-Class: Finally >manifest.txt
C:\Finally>jar cvfm Finally.jar mainfest.txt *.class Images
java.io.FileNotFoundException: mainfest.txt (The system cannot find the file spe
cified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at java.io.FileInputStream.<init>(FileInputStream.java:66)
        at sun.tools.jar.Main.run(Main.java:122)
        at sun.tools.jar.Main.main(Main.java:903)
C:\Finally>echo Main-Class: Finally >manifest.txt
C:\Finally>jar cvfm Finally.jar manifest.txt *.class Images
added manifest
adding: ColorPanel.class(in = 828) (out= 495)(deflated 40%)
adding: Finally.class(in = 715) (out= 481)(deflated 32%)
adding: GUIWindow$1.class(in = 178) (out= 147)(deflated 17%)
adding: GUIWindow$algListener.class(in = 1480) (out= 753)(deflated 49%)
adding: GUIWindow$HListener.class(in = 1547) (out= 869)(deflated 43%)
adding: GUIWindow$PiListener.class(in = 1550) (out= 869)(deflated 43%)
adding: GUIWindow$saveListener.class(in = 1422) (out= 712)(deflated 49%)
adding: GUIWindow$TListener.class(in = 1546) (out= 860)(deflated 44%)
adding: GUIWindow$UListener.class(in = 1547) (out= 874)(deflated 43%)
adding: GUIWindow.class(in = 4443) (out= 1883)(deflated 57%)
adding: Images/(in = 0) (out= 0)(stored 0%)
adding: Images/1.jpg(in = 17780) (out= 12000)(deflated 32%)
adding: Images/19.jpg(in = 17566) (out= 11809)(deflated 32%)
adding: Images/2.jpg(in = 17312) (out= 11559)(deflated 33%)
adding: Images/20.jpg(in = 17316) (out= 11494)(deflated 33%)
adding: Images/21.jpg(in = 17665) (out= 11904)(deflated 32%)
adding: Images/22.jpg(in = 17252) (out= 11517)(deflated 33%)
adding: Images/23.jpg(in = 17442) (out= 11651)(deflated 33%)
adding: Images/24.jpg(in = 17411) (out= 11714)(deflated 32%)
adding: Images/25.jpg(in = 17494) (out= 11698)(deflated 33%)
adding: Images/26.jpg(in = 17359) (out= 11626)(deflated 33%)
adding: Images/7.jpg(in = 21867) (out= 13193)(deflated 39%)
C:\Finally>jar cvfm Finally.jar manifest.txt *.class Images
added manifest
adding: ColorPanel.class(in = 828) (out= 495)(deflated 40%)
adding: Finally.class(in = 715) (out= 481)(deflated 32%)
adding: GUIWindow$1.class(in = 178) (out= 147)(deflated 17%)
adding: GUIWindow$algListener.class(in = 1480) (out= 753)(deflated 49%)
adding: GUIWindow$HListener.class(in = 1547) (out= 869)(deflated 43%)
adding: GUIWindow$PiListener.class(in = 1550) (out= 869)(deflated 43%)
adding: GUIWindow$saveListener.class(in = 1422) (out= 712)(deflated 49%)
adding: GUIWindow$TListener.class(in = 1546) (out= 860)(deflated 44%)
adding: GUIWindow$UListener.class(in = 1547) (out= 874)(deflated 43%)
adding: GUIWindow.class(in = 4443) (out= 1883)(deflated 57%)
adding: Images/(in = 0) (out= 0)(stored 0%)
adding: Images/1.jpg(in = 17780) (out= 12000)(deflated 32%)
adding: Images/19.jpg(in = 17566) (out= 11809)(deflated 32%)
adding: Images/2.jpg(in = 17312) (out= 11559)(deflated 33%)
adding: Images/20.jpg(in = 17316) (out= 11494)(deflated 33%)
adding: Images/21.jpg(in = 17665) (out= 11904)(deflated 32%)
adding: Images/22.jpg(in = 17252) (out= 11517)(deflated 33%)
adding: Images/23.jpg(in = 17442) (out= 11651)(deflated 33%)
adding: Images/24.jpg(in = 17411) (out= 11714)(deflated 32%)
adding: Images/25.jpg(in = 17494) (out= 11698)(deflated 33%)
adding: Images/26.jpg(in = 17359) (out= 11626)(deflated 33%)
adding: Images/7.jpg(in = 21867) (out= 13193)(deflated 39%)
C:\Finally>jar cvfm Finally.jar manifest.txt *.class Images
added manifest
adding: ColorPanel.class(in = 828) (out= 495)(deflated 40%)
adding: Finally.class(in = 715) (out= 481)(deflated 32%)
adding: GUIWindow$1.class(in = 178) (out= 147)(deflated 17%)
adding: GUIWindow$algListener.class(in = 1480) (out= 753)(deflated 49%)
adding: GUIWindow$HListener.class(in = 1547) (out= 869)(deflated 43%)
adding: GUIWindow$PiListener.class(in = 1550) (out= 869)(deflated 43%)
adding: GUIWindow$saveListener.class(in = 1422) (out= 712)(deflated 49%)
adding: GUIWindow$TListener.class(in = 1546) (out= 860)(deflated 44%)
adding: GUIWindow$UListener.class(in = 1547) (out= 874)(deflated 43%)
adding: GUIWindow.class(in = 4443) (out= 1883)(deflated 57%)
adding: Images/(in = 0) (out= 0)(stored 0%)
adding: Images/1.jpg(in = 17780) (out= 12000)(deflated 32%)
adding: Images/19.jpg(in = 17566) (out= 11809)(deflated 32%)
adding: Images/2.jpg(in = 17312) (out= 11559)(deflated 33%)
adding: Images/20.jpg(in = 17316) (out= 11494)(deflated 33%)
adding: Images/21.jpg(in = 17665) (out= 11904)(deflated 32%)
adding: Images/22.jpg(in = 17252) (out= 11517)(deflated 33%)
adding: Images/23.jpg(in = 17442) (out= 11651)(deflated 33%)
adding: Images/24.jpg(in = 17411) (out= 11714)(deflated 32%)
adding: Images/25.jpg(in = 17494) (out= 11698)(deflated 33%)
adding: Images/26.jpg(in = 17359) (out= 11626)(deflated 33%)
adding: Images/7.jpg(in = 21867) (out= 13193)(deflated 39%)
C:\Finally>
```
 
but now when I click on Finally.jar if give me the error "Could not find main class. Program will exit."


----------



## ThatGuy (Jun 3, 2010)

self post. Someone must know?


----------

