Java – default parameter in jar manifest

Is there any way to create a jar file that contains some parameters passed to the main class? (no need to add parameters to potential command line parameters.)

I know I can simply write a bootstrap class and specify it as the main class (calling the real main class with parameters), but it seems a little awkward

Solution

As far as I know, No You have to do this yourself in the code

Many people find that writing a main class sets up an environment and then acts as a classloader for the "real" main program Usually, such a preprocessor has nothing to do with the classpath of the application, but the problems you encounter are other problems that can be solved

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>