Thursday 2 September 2010

Create a jar file with .class file and properties files.

1. You need a menifest file:

App_Data_Export.mf

its content should look like this:

Manifest-Version: 1.0
Main-Class: App_Data_Export
Class-Path: . jars/commons-cli-1.0.jar jars/commons-lang-2.4.jar jars/commons-logging-1.1.1.jar jars/jdbcpersistence.jar jars/log4j-1.2.8.jar conf/test/.

all the paths are relative to the jar file being created and conf/test folder contains all the properties file.

2. Create a jar file.
$jar cmf App_Data_Export.mf App_Data_Export.jar App_Data_Export.class

3. To run the jar.
java -Xmx1024M -jar ${DATA_EXPORT_JAR} -config ${BASE_CONFIG_FILE} -filename ${DATA_FILE_PATH}/${DATA_FILE_NAME} -user cmms -password cmms | tee -a ${LOG_FILES}/${LOG_FILE_NAME}

where:
1. ${DATA_EXPORT_JAR} is the path of the JAR File we just created
2. -config and -filename are arguments to the main class.
3. tee -a ${LOG_FILES}/${LOG_FILE_NAME}, allows you to put the output to the output file and also see the output on the standard output.

Enjoy :).

No comments:

Post a Comment

Azure OpenAI Architecture Patterns & Deployment Patterns

Sharing some useful links that will help customers architect Azure OpenAI solution using the best practices: (1) Azure OpenAI Landing Zone r...