0
votes

I am inside a E:/foo/bar folder inside windows environment. I have a jar file as E:/foo/bar/a.jar. Also inside foo/bar there are lot of jar files. Also under the foo/bar there is another directory called ext. It also includes lot of jar files.

I want to run the a.jar with those jars included in the class path(both current directory and ext directory). So I used this.

java -jar a.jar -classpath *:/ext/*

This didn't work. I didnt add any entries in the MANIFEST.MF in a.jar thinking that this will be fetched from the -classpath entry. What am I doing wrong here?

Thank you

1

1 Answers

1
votes

The -classpath option is ignored if -jar is specified.

Two possible course of action I can see:

  1. Put a manifest in the main Jar that does specify the other Jars.
  2. Specify the class-path at run-time.
    1. Drop the -jar option of the invocation.
    2. Specify all the dependent Jars
    3. Add the fully qualified class name to the end of the command, something like
      java -classpath *:/ext/* com.our.MainClass