tags:

views:

95

answers:

2

I have downloaded the source code of Apache Lucene using svn. Now I want to create a jar file for a particular java file in the contrib portion of the code.

the problem is that when I do javac x.java to get a class file and package it into a jar file using jar cf jarfile.jar x.class the package hierarchy is not preserved in the jar file.

what is the correct way of packaging class files into the jar file maintaining the package hierarchy?

Particularly with svn checked out code is there a better way of packaging selected java files.

A: 

Lucene have ant's build.xml, you can make jar by using ant package at lucene source directory. For contribs there are also contrib/contrib-build.xml

splix
+1  A: 
mindas:/tmp/test$ pwd
/tmp/test
mindas:/tmp/test$ ls
mindas:/tmp/test$ mkdir some
mindas:/tmp/test$ mkdir some/package
mindas:/tmp/test$ touch some/package/SomeFile.class
mindas:/tmp/test$ jar cf jarfile.jar some/package/SomeFile.class

That does preserve the structure.

mindas