Welcome to Dream.In.Code
Become a Java Expert!

Join 150,064 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,758 people online right now. Registration is fast and FREE... Join Now!




Help creating .jar file

2 Pages V  1 2 >  
Reply to this topicStart new topic

Help creating .jar file

thenovices
6 Jun, 2008 - 08:37 PM
Post #1

D.I.C Head
**

Joined: 18 Jan, 2008
Posts: 73



Thanked: 7 times
My Contributions
So yeah, I just tried making a .jar file. It seems to work, the point of entry is working correctly, except it doesn't seem to be able to read the images (The background is gray). The images are in their own package, and i double checked to make sure that the images were being exported. I downloaded the Fat-Jar plugin for Eclipse to see if that worked. Now this is the weird part. If I double click on the .jar file within Eclipse, then it is gray. If I open the actual folder through Windows and double click the .jar file, it works!! And if I copy it to the Desktop, it doesn't work.

Everybody's help is greatly appreciated!
User is offlineProfile CardPM
+Quote Post

pbl
RE: Help Creating .jar File
6 Jun, 2008 - 08:40 PM
Post #2

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
QUOTE(thenovices @ 6 Jun, 2008 - 09:37 PM) *

So yeah, I just tried making a .jar file. It seems to work, the point of entry is working correctly, except it doesn't seem to be able to read the images (The background is gray). The images are in their own package, and i double checked to make sure that the images were being exported. I downloaded the Fat-Jar plugin for Eclipse to see if that worked. Now this is the weird part. If I double click on the .jar file within Eclipse, then it is gray. If I open the actual folder through Windows and double click the .jar file, it works!! And if I copy it to the Desktop, it doesn't work.

Everybody's help is greatly appreciated!

My best friend in "my favorites"

http://java.sun.com/docs/books/tutorial/deployment/jar/


User is online!Profile CardPM
+Quote Post

thenovices
RE: Help Creating .jar File
6 Jun, 2008 - 08:59 PM
Post #3

D.I.C Head
**

Joined: 18 Jan, 2008
Posts: 73



Thanked: 7 times
My Contributions
yeah i already had that page open...

i'm trying it, but with little success. I don't have too much experience with cmd. I know the basics, but I am still a noob.

right now its telling me "Failed to load Main-Class manifest attribute from " the jar file.

I made a manifest.txt file with

Main-Class: finale.finaleApp

And i made sure that it had an empty line below it. I double checked my command line stuff. Any ideas?
User is offlineProfile CardPM
+Quote Post

mensahero
RE: Help Creating .jar File
6 Jun, 2008 - 09:23 PM
Post #4

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
well.. you can use a simple winzip utility tool.. if you know how to make a winzip archive then thats how to make a jar archive..

1. Add all your resources.. your root folder which contain all the directory needed by your program into one .zip archive.

2. rename the .zip file into .jar..

that workz perfectly for me..

This post has been edited by mensahero: 6 Jun, 2008 - 09:23 PM
User is offlineProfile CardPM
+Quote Post

thenovices
RE: Help Creating .jar File
6 Jun, 2008 - 09:26 PM
Post #5

D.I.C Head
**

Joined: 18 Jan, 2008
Posts: 73



Thanked: 7 times
My Contributions
correct me if i'm wrong, but that is just compressing the files. I am trying to make an executable .jar file.

btw, i finally managed to make a .jar file using command line stuff. Unfortunately, I am getting the exact same result as the .jar file I created using both the Eclipse built-in .jar builder and the Eclipse Fat Jar plugin. The .jar file doesn't seem to be able to open the images and stuff.
User is offlineProfile CardPM
+Quote Post

pbl
RE: Help Creating .jar File
6 Jun, 2008 - 09:35 PM
Post #6

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
QUOTE(thenovices @ 6 Jun, 2008 - 10:26 PM) *

correct me if i'm wrong, but that is just compressing the files. I am trying to make an executable .jar file.

btw, i finally managed to make a .jar file using command line stuff. Unfortunately, I am getting the exact same result as the .jar file I created using both the Eclipse built-in .jar builder and the Eclipse Fat Jar plugin. The .jar file doesn't seem to be able to open the images and stuff.

manifest.mf is the name of the file
User is online!Profile CardPM
+Quote Post

thenovices
RE: Help Creating .jar File
6 Jun, 2008 - 09:48 PM
Post #7

D.I.C Head
**

Joined: 18 Jan, 2008
Posts: 73



Thanked: 7 times
My Contributions
huh? I don't understand what you mean. what file?

Well I mean I did create a manifest.mf in a META-INF folder, which finally allowed me to make a .jar with the entry point working, but I dont' understand what you meant.
User is offlineProfile CardPM
+Quote Post

pbl
RE: Help Creating .jar File
6 Jun, 2008 - 09:51 PM
Post #8

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
QUOTE(thenovices @ 6 Jun, 2008 - 10:48 PM) *

huh? I don't understand what you mean. what file?

Well I mean I did create a manifest.mf in a META-INF folder, which finally allowed me to make a .jar with the entry point working, but I dont' understand what you meant.

when you double click on a .jar the system look for the file manifest.mf to find what the main class is
if your file is named manifest.txt it won't find it
User is online!Profile CardPM
+Quote Post

mensahero
RE: Help Creating .jar File
6 Jun, 2008 - 09:58 PM
Post #9

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
Tutorial on how to make an executable JAR FILE

blink.gif blink.gif hope that help..
User is offlineProfile CardPM
+Quote Post

pbl
RE: Help Creating .jar File
6 Jun, 2008 - 10:03 PM
Post #10

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
QUOTE(mensahero @ 6 Jun, 2008 - 10:58 PM) *

Mensahero always right... one day I'll get pissed biggrin.gif
User is online!Profile CardPM
+Quote Post

thenovices
RE: Help Creating .jar File
6 Jun, 2008 - 10:05 PM
Post #11

D.I.C Head
**

Joined: 18 Jan, 2008
Posts: 73



Thanked: 7 times
My Contributions
yeah i changed it to manifest.mf and now the entry point works. except the images still aren't loading.
User is offlineProfile CardPM
+Quote Post

mensahero
RE: Help Creating .jar File
6 Jun, 2008 - 10:08 PM
Post #12

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
QUOTE(thenovices @ 6 Jun, 2008 - 11:05 PM) *

yeah i changed it to manifest.mf and now the entry point works. except the images still aren't loading.


add a System.out.println in every loading images code you have.. then when testing the jar file open the console.

that's a good way to test if the images does load..or you have a directory problem. blink.gif
User is offlineProfile CardPM
+Quote Post

2 Pages V  1 2 >
Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 10:41PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month