• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to jar a package

 
Dean Reedy
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to jar a package application
Here is what I have:
1) directory structure of c:\dmsi\campaignbuilder\<here are the class files>
2) my package name is: dmsi.campaignbuilder
3) I have subdirectories of: c:\dmsi\campaignbuilder\images\<image files are here>
4) I have created a text file name startclass.txt with the following: Main-Class: CampaignBuilder
How do I create the jar for this application, from which directory do I create it, and how do I run it.
Any help would be great.
thanks,
Dean
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First you need to change 'startclass.txt' to:

and then run this command from C:\

You can now run it by typing: 'java -jar dmsi.jar' or if you are running Win32 just double clik on it.
Rene
 
Dean Reedy
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still get an error trying to run it. I get "Exception in thread "Main" java.lang.ClassFormatError: dmsi/campaignbuilder/CampaignBuilder$1 (Bad magic number)............and whole bunch of classloader errors. Any ideas, what I might have done wrong?
Thanks,
Dean
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you running it without the jar file?
/Rene
 
Dean Reedy
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I run it by having all of the compile class files in the following directory: C:\dmsi\campaignbuilder\
The exact command I use in for c:\
I type c:\jdk1.3.1_02\bin\java dmsi.campaignbuilder.CampaignBuilder
To run the jar file, I have been typing
c:\jdk1.3.1_02\bin\java -jar dmsi.jar
The jar file exists and looks good, I am running it from the c:
Any ideas.
Thanks,
 
Dean Reedy
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, I did the above and got rid of the magic number error, I had muliple jar files.
Now I am getting the error:
java.lang.NoClassDefFoundError: dmsi.campaignbuilder.CampaignBuilder
Any ideas anyone?
Thanks,
Dean
 
Dean Reedy
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I finally got it to work!!
Here is what I used: http://csdl.ics.hawaii.edu/~johnson/613f99/modules/04/jar-files.html
c:\jdk1.3.1_02\bin\jar cmf startclass.txt dmsi.jar dmsi
c:\jdk1.3.1_02\bin\java -jar dmsi.jar
thanks everyone.
Dean
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic