I am trying to run a class from a JAR. This class is NOT the only main class in this jar. Also, it requires number of other jar files, which I have kept in the same directory as
try:
java -cp C:\temp\test_myProj\mysql-connector-java-5.1.13-bin.jar;myProjImport.jar com.mycomp.myProj.importer.csv.TestImporter "C:\Documents and Settings\user\workspace\myProjImport\src\conf\datasource.properties" "C:\temp\apollo_claims_test.txt
"
provided your running this from the same direcotry as myProjImport.jar
When -jar option is specified, any other class path options are ignored. So this won't work:
java -jar MyJar.jar -classpath foo.jar
But if you place foo.jar name into META-INF/manifest.mf within MyJar.jar:
Class-Path: foo.jar
Then the foo.jar will be searched on the same level as MyJar.jar, i.e. in the same directory.
Sometimes I just unpack all dependent JARs and pack their content into MyJar.jar. Fewer dependencies this way.