Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #13764
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!news1.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Sat, 21 Apr 2012 17:01:53 -0500 |
| Date | Sat, 21 Apr 2012 15:01:58 -0700 |
| From | Patricia Shanahan <pats@acm.org> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 |
| MIME-Version | 1.0 |
| 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> |
| In-Reply-To | <4f932a25$0$4810$c3e8da3$10694f1e@news.astraweb.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Message-ID | <mPCdnbT9KJTMsw7SnZ2dnUVZ_hadnZ2d@earthlink.com> (permalink) |
| Lines | 25 |
| X-Usenet-Provider | http://www.giganews.com |
| NNTP-Posting-Host | 70.230.201.141 |
| X-Trace | sv3-IjH/zZ7Wu2pKI7aAT6FN4M46kD95XZGkIWIS89ywMFWf9AhWC/qc6dhu3yZyG8G2jf4ZOp202m5pK7n!lBONCwIX74fFZSLRqR973N/pEvvbups5MiXhrfx8mP8NpjvNXfhCCoz2COOufzoTIPQe5IcJYJo0!DHSQPH0ixHfOmNEq5TzXg/NGqjot694grXaX4LFvumZpwnU= |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 2104 |
| X-Received-Bytes | 2298 |
| Xref | csiph.com comp.lang.java.programmer:13764 |
Show key headers only | View raw
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