Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #13764
| Date | 2012-04-21 15:01 -0700 |
|---|---|
| From | Patricia Shanahan <pats@acm.org> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Command-line options in a jar file |
| References | <4f93064c$0$5461$c3e8da3$eb767761@news.astraweb.com> <jmv8c3$fka$1@localhost.localdomain> <4f932a25$0$4810$c3e8da3$10694f1e@news.astraweb.com> |
| Message-ID | <mPCdnbT9KJTMsw7SnZ2dnUVZ_hadnZ2d@earthlink.com> (permalink) |
On 4/21/2012 2:43 PM, Hiram Hunt wrote:
...
> Thanks. Yes, I know I can put options before the -jar option, but I would
> like to be able to just run the program as "MyProgram.jar" by using the
> ftype association in my original post. Thus, my question is about passing
> arguments for java.exe in the jar file. My guess at this point is that it
> is
> not possible.
Remember that a Java main is just a static method, and can be called.
You could write, include in your jar, and make the main class something
like this:
=====WARNING===UNTESTED=CODE========
public class Wrapper {
private static String[] actualArgs = {
"arg1",
"arg2",
}
public static void main(String[] args) {
HelloWorld.main(actualArgs);
}
}
====================================
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Command-line options in a jar file "Hiram Hunt" <hiramhunt@verizon.net> - 2012-04-21 15:11 -0400
Re: Command-line options in a jar file Lew <noone@lewscanon.com> - 2012-04-21 13:17 -0700
Re: Command-line options in a jar file "Hiram Hunt" <hiramhunt@verizon.net> - 2012-04-21 17:27 -0400
Re: Command-line options in a jar file Jan Burse <janburse@fastmail.fm> - 2012-04-22 00:32 +0200
Re: Command-line options in a jar file "Hiram Hunt" <hiramhunt@verizon.net> - 2012-04-21 19:23 -0400
Re: Command-line options in a jar file Jan Burse <janburse@fastmail.fm> - 2012-04-22 01:31 +0200
Re: Command-line options in a jar file "Hiram Hunt" <hiramhunt@verizon.net> - 2012-04-21 20:10 -0400
Re: Command-line options in a jar file "John B. Matthews" <nospam@nospam.invalid> - 2012-04-22 07:16 -0400
Re: Command-line options in a jar file "Hiram Hunt" <hiramhunt@verizon.net> - 2012-04-22 13:15 -0400
Re: Command-line options in a jar file Arne Vajhøj <arne@vajhoej.dk> - 2012-04-21 22:05 -0400
Re: Command-line options in a jar file "Hiram Hunt" <hiramhunt@verizon.net> - 2012-04-22 07:10 -0400
Re: Command-line options in a jar file Martin Gregorie <martin@address-in-sig.invalid> - 2012-04-21 21:21 +0000
Re: Command-line options in a jar file "Hiram Hunt" <hiramhunt@verizon.net> - 2012-04-21 17:43 -0400
Re: Command-line options in a jar file Patricia Shanahan <pats@acm.org> - 2012-04-21 15:01 -0700
Re: Command-line options in a jar file "Hiram Hunt" <hiramhunt@verizon.net> - 2012-04-21 18:56 -0400
Re: Command-line options in a jar file Knute Johnson <nospam@knutejohnson.com> - 2012-04-21 15:34 -0700
Re: Command-line options in a jar file "Hiram Hunt" <hiramhunt@verizon.net> - 2012-04-21 19:04 -0400
Re: Command-line options in a jar file Roedy Green <see_website@mindprod.com.invalid> - 2012-04-21 23:18 -0700
Re: Command-line options in a jar file "Hiram Hunt" <hiramhunt@verizon.net> - 2012-04-22 07:07 -0400
csiph-web