reset password
Author Message
rabbott
Posts: 1649
Posted 19:30 May 05, 2012 |

It finally dawned on me that since we are not submitting a single

.jar file to an external competition manager (at least not yet), it's not

necessary to package all the Guava library classes in the jar file

you build.

 

I created a Guava folder in CS_460_Ants_Programs. It contains both

the Guava .jar file as well as the class files extracted from that .jar file.

 

My previous make file in the top level ChainedAStar directory contained 

one line to make a jar file.

jar cfmv ../../ChainedAStar.jar Manifest.txt -C bin . -C ../../Guava/ com  

I finally found out how to include files in a jar file without going to the directory.

The -C flag instructs the jar file constructor to go temporarily to the indicated

directory and then add the indicated files.  In this case, "-C bin ." says to go

into the bin directory and add all the files, including the files in the folders.

So that portion will package up all the .class files of the application. The portion

that reads "_C ../../Guava/com goes to the Guava folder mentioned above and

adds the class files extracted from the .jar file. (The extraction has to be done

separately. As I've mentioned, I don't know how to package class files from

a jar file when building another jar file.)

 

The alternative is not to package the Guava class files and to make them

available when the bot is run. Assuming the bot will be run from the top level

directory one can add the following to the manifest file.

 

Class-Path: Guava/guava-11.0.2.jar
This tell the runtime system that the Guava class files are available in the indicated
jar file. Doing that shrinks the size of the bot's jar file from over 1.6MB to 50KB. My
current make file has this single line.
jar cfmv ../../ChainedAStar.jar Manifest.txt -C bin . 
It says to build a jar file named ChainedAStar.jar at ../../ (which is the top level
directory. Include in it the Manifest.txt file in the current directory (where the make
file is located, and add the class files in the bin directory.