Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 12-08-2004, 11:47 AM   #1 (permalink)
freesoft_2000
Code Monkey
 
Join Date: Oct 2004
Posts: 51
freesoft_2000 is on a distinguished road
Question Creating Jars

Hi everyone,

I have an application that i need to distribute as a jar but i have no idea how to create the jar archive as well as something called the manifest file. Basically i have only one class and the main is in that class itself. The path of the of the the file i want to archive is as follows:

C://wt//ter//Jhutto.class

and the path of my of my jar.exe is as follows:

C://java_1.4//bin//jar.exe

Could someone also explain(in detail if possible) to me or direct me to an informative website that explains what the manifest file is all about and also how to write a manifest file.

Any help is greatly appreciated

Thank You

Yours Sincerely

Richard West
freesoft_2000 is offline   Reply With Quote
Old 12-08-2004, 12:38 PM   #2 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,161
Belisarius is on a distinguished road
I've only used Ant to create jars before, so I'm not familiar on how to do it from scratch. But Sun does have a tutorial on jars.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 12-09-2004, 01:02 AM   #3 (permalink)
freesoft_2000
Code Monkey
 
Join Date: Oct 2004
Posts: 51
freesoft_2000 is on a distinguished road
Hi everyone,

I have to ask you something belisarius what is ant? I have been to their website but still do not understand what they are talking about. This ant you talk about how do i use it to create jars. Could you explain in detail if possible

Yours Sincerely

Richard West
freesoft_2000 is offline   Reply With Quote
Old 12-09-2004, 04:31 AM   #4 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,161
Belisarius is on a distinguished road
Ant is like "make", only for Java programs. It allows you to create complex compiles, and will also only compile what is new. For instance, I use it to keep my source files and class files seperate in all my projects. I also create jars in what would otherwise be a massive headache, as I need to include other jars within the created jar (you have to unpack and include the class files, you can't simply include a jar within a jar).

The manual is a bit confusing, but if you stick with it you can usually figure out what you need to know. Here is the manual page on creating a jar in Ant, and it includes examples.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 12-09-2004, 04:45 AM   #5 (permalink)
kaeli69
Registered User
 
kaeli69's Avatar
 
Join Date: Apr 2003
Posts: 30
kaeli69 is an unknown quantity at this point
The jar command can create the manifest for you.
You don't need to use Ant.

From my command line...
Quote:
Usage: 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 file
If any file is a directory then it is processed recursively.
The manifest file name and the archive file name needs to be specified
in 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.class
Example 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/ .
From http://java.sun.com/docs/books/tutor...ics/build.html
Quote:
This command will generate a compressed JAR file and place it in the current directory. The command will also generate a default manifest file for the JAR archive.
See more here:
http://java.sun.com/docs/books/tutor.../manifest.html
kaeli69 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Labels in VB patelk MS Technologies ( ASP, VB, C#, .NET ) 0 10-26-2004 10:06 AM
creating dynamic variable names sde PHP 5 11-02-2002 09:03 AM
creating an array of an object on the freestore in c++ ?? sde Standard C, C++ 7 08-04-2002 01:39 PM


All times are GMT -8. The time now is 04:22 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting