简体   繁体   English

从命令行执行jar,里面有jar

[英]executing jar from command line with jars inside

I saw running jar from command line . 我看到从命令行运行jar

However my case is different. 但是我的情况有所不同。 I put the jars needed for the main class under lib folder. 我把主类所需的jar放在lib文件夹下。 So my jar is like this: 所以我的罐子是这样的:

lib
META-INF
VideoFieldsResults.class

in the META-INF I have: 在META-INF我有:

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? 如何运行命令行,指定jar中需要lib文件夹下的所有jar?

By default, Java cannot load jars from within jars. 默认情况下,Java无法从jar中加载jar。 To accomplish this, you would need a classloader that can handle it. 要做到这一点,你需要一个可以处理它的类加载器。 For example One-Jar . 例如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 还有其他选择(取决于你如何设置包括罐子里面的罐子或如果扁平罐子是一个选项),我建议这个问题的答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM