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 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> <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: 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 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); } } ====================================