在JAR-清单默认参数 [英] Default arguments in JAR-manifest

查看:115
本文介绍了在JAR-清单默认参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来创建一个JAR文件,它包含传递给主类一些参数? (不要紧,它是否prepends或追加参数潜在的命令行参数。)

Is there a way to create a JAR-file that contains some arguments that are passed to the main class? (It does not matter whether it prepends or appends the arguments to potential command line arguments.)

我知道我可以简单地写一个引导类,并指定此作为主类(调用带参数的真正主类),但这似乎有点尴尬。

I know I could simply write a bootstrapping class and specify this as main class (calling the real main class with the arguments), but this seems a bit awkward.

推荐答案

据我所知,没有。你必须做这种事情自己在code。

To the best of my knowledge, no. You'll have to do that kind of thing yourself, in code.

很多人发现它有用编写设置了一个环境,然后充当真正的主程序ClassLoader的一个小主类。通常情况下,这样的pre-电源拨弄自己的应用程序的classpath,但是你这样的问题是别的东西,可以解决这个样子。

A lot of people find it useful to write a little main class that sets up an environment and then acts as a ClassLoader for the "real" main program. Typically, such pre-mains fiddle with the classpath of their application, but your kind of problem is something else that could be solved like this.

这篇关于在JAR-清单默认参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆