Skip to main content
GameDev.net gamedev.net
🔒 Locked

JAR file creation

Started by Wutalife37 Apr 14, 2005 at 2:00 PM 3 replies 1k views
Original Post
Wutalife37
Wutalife37
This has slowly been driving me insane. I'm trying to put a bunch of files into a JAR, but I can't figure out how. Every place I have gone to has been no help. Can anyone point me to a good place that explains, in very simple terms, how to make a JAR file. I would greatly appreciate it.
Ra
Ra
JAR files are for the most part ZIP files with the .jar extension. You can use nearly any compressor to create ZIP files; then you just rename them.

I believe some features like signing need to be done with a JAR utility but for JARs that only contain files ZIP should work fine.
Ra
jollyjeffers
jollyjeffers
There is a program that ships with most JRE's called jar.exe that can be used to do exactly what you want [smile]

the command line is a little obscure, and you need to write up a manifest iirc - but you should be able to find something out...

C:\j2sdk1.4.1_02\bin>jarUsage: jar {ctxu}[vfm0Mi] [jar-file] [manifest-file] [-C dir] files ...Options:    -c  create new archive    -t  list table of contents for archive    -x  extract named (or all) files from archive    -u  update existing archive    -v  generate verbose output on standard output    -f  specify archive file name    -m  include manifest information from specified manifest file    -0  store only; use no ZIP compression    -M  do not create a manifest file for the entries    -i  generate index information for the specified jar files    -C  change to the specified directory and include the following fileIf any file is a directory then it is processed recursively.The manifest file name and the archive file name needs to be specifiedin the same order the 'm' and 'f' flags are specified.Example 1: to archive two class files into an archive called classes.jar:       jar cvf classes.jar Foo.class Bar.classExample 2: use an existing manifest file 'mymanifest' and archive all the           files in the foo/ directory into 'classes.jar':       jar cvfm classes.jar mymanifest -C foo/ .


is what my version tells me.

iirc, I used jar -cfm *.class Manifest.mf Application.jar, but my memory's a little rusty...

hth
Jack
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ |
darklordsatan
darklordsatan
What Ive used to make a JAR outta a folder is this:

$ jar cf database.jar DataBase

where supossedly DataBase contains all the .class files (and yes, they deal with a database!!!)

Its that simple, cheers

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.