Dejell
Dejell

Reputation: 14317

executing jar from command line with jars inside

I saw running jar from command line.

However my case is different. I put the jars needed for the main class under lib folder. So my jar is like this:

lib
META-INF
VideoFieldsResults.class

in the META-INF I have:

Manifest-Version: 1.0
Main-Class: VideoFieldResults

when I try to run:

java -jar VideoFormat.jar onBa32hgnBg,Lh-BKkLYYBU C:\VideoFormat2.csv

Where the last 2 are arguments I get:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/gdata/util
/ServiceException

Which does exists under one of the jars inside!

How can I run a command line specifying that all the jars under lib folder inside are required for the jar?

Upvotes: 0

Views: 863

Answers (1)

Charlie
Charlie

Reputation: 7349

By default, Java cannot load jars from within jars. To accomplish this, you would need a classloader that can handle it. For example One-Jar. There are other options as well (depending on how set you are with including jars inside of a jar or if flattening jars is an option), I'd recommend the answer to this other question

Upvotes: 2

Related Questions