The Artima Developer Community
Sponsored Link

Java Answers Forum
jar packaging

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Steve Schooler

Posts: 17
Nickname: zugzwang
Registered: Aug, 2004

jar packaging Posted: Mar 14, 2005 12:06 PM
Reply to this message Reply
Advertisement

I'm attempting to package a coding sample into a runnable jar file, for a job
application. The directory structure that I want is:

<parent dir>/class/regexapp/<class files>
<parent dir>/docs/regexapp/<doc files>
<parent dir>/source/regexapp/<source files>

The code assumes files are created in a package called regexapp, with entry
point = regexapp.TestRegex. I want a single jar file, with no nested jar files,
to include all class, doc, and source files. I also want this jar file to be
runnable. The only way that I have found to create the directory structure that
I want is to execute the following in Dos, from the <parent dir>:

jar -cf TestRegex.jar *.* <or jar -cmf Manifest.txt TestRegex.jar *.*>

To make it runnable (via java -jar ...), I need a manifest file with an entry
like:
Main-Class: regexapp.TestRegex

But, if I create the jar file from the <parent dir>/class directory, I won't get
the directory structure that I want. Instead, if I create it from the <parent
dir>, how do I specify (in the manifest):

1. The main class?
2. The fact that the executable class path INSIDE the jar file should be
<parent dir>/class?

Apparently, the manifest entry for Class-Path is not relevant, since that seems
to apply to the location of files EXTERNAL to the jar. Apparently, what I want
is not doable. Comments?

Assuming that it is not doable, how is this situation typically treated? Should
I create three separate jar files (class.jar, source.jar, docs.jar)? If so, do
I then package them into one superordinate jar file, or is a zip file more
routine?

What type of email attachment will please the job interviewer? Will both
methods in above paragraph force interviewer to unpack the zip/jar file and then
run the (nested) class.jar?

Topic: Free and programing is possible with a new PC. No questions just promotiona Previous Topic   Next Topic Topic: Accessing the windows registry

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use