Prev: Building an Embedded Device/System? Tell VDC about your experiences for a chance to WIN!
Next: www.promptc.com (free shipping,only $16-69) for NFL jersey--Paypal
From: mike on 18 May 2010 10:57 Hi, On the command line I can execute the following: java -jar eclipse.jar -application org.eclipse.StandAloneUpdate - command list I want to execute this from within a java program. I have added the eclipse.jar in my java program so that I can access the StandAloneUpdate class. How can I run execute the StandAloneUpdate class with the two commands ( -command list)? Use reflection or use system call using ProcessBuilder? All ideas are welcome. br, //mike
From: Eric Sosman on 18 May 2010 11:09 On 5/18/2010 10:57 AM, mike wrote: > Hi, > > On the command line I can execute the following: > > java -jar eclipse.jar -application org.eclipse.StandAloneUpdate - > command list > > I want to execute this from within a java program. > I have added the eclipse.jar in my java program so that I can access > the StandAloneUpdate class. > How can I run execute the StandAloneUpdate class with the two commands > ( -command list)? > Use reflection or use system call using ProcessBuilder? All ideas are > welcome. Perhaps I've misunderstood your question, but what's wrong with org.eclipse.StandAloneUpdate.main( new String[] { "-command", "list" } ); ? -- Eric Sosman esosman(a)ieee-dot-org.invalid
From: Lew on 18 May 2010 13:32 mike wrote: >> On the command line I can execute the following: >> >> java -jar eclipse.jar -application org.eclipse.StandAloneUpdate - >> command list >> >> I want to execute this from within a java [sic] program. >> I have added the eclipse.jar in my java [sic] program so that I can access >> the StandAloneUpdate class. >> How can I run execute the StandAloneUpdate class with the two commands >> ( -command list)? >> Use reflection or use system call using ProcessBuilder? All ideas are >> welcome. Eric Sosman wrote: > Perhaps I've misunderstood your question, but what's wrong with > > org.eclipse.StandAloneUpdate.main( > new String[] { "-command", "list" } ); > > ? or org.eclipse.StandAloneUpdate.main( "-command", "list" ); -- Lew
From: BGB / cr88192 on 21 May 2010 10:16 "Lew" <noone(a)lewscanon.com> wrote in message news:hsuiua$82f$1(a)news.albasani.net... > mike wrote: >>> On the command line I can execute the following: >>> >>> java -jar eclipse.jar -application org.eclipse.StandAloneUpdate - >>> command list >>> >>> I want to execute this from within a java [sic] program. >>> I have added the eclipse.jar in my java [sic] program so that I can >>> access >>> the StandAloneUpdate class. >>> How can I run execute the StandAloneUpdate class with the two commands >>> ( -command list)? >>> Use reflection or use system call using ProcessBuilder? All ideas are >>> welcome. > > Eric Sosman wrote: >> Perhaps I've misunderstood your question, but what's wrong with >> >> org.eclipse.StandAloneUpdate.main( >> new String[] { "-command", "list" } ); >> >> ? > > or > org.eclipse.StandAloneUpdate.main( "-command", "list" ); > invalid number of arguments for method 'main'. cannot convert from String to String[]. main has no matching definition for (String, String). ?... unless I am wrong ang someone does declare main as: public static void main(String... args); rather than: public static void main(String[] args); unless I have missed something here?... > -- > Lew
From: Arne Vajhøj on 21 May 2010 21:21
On 21-05-2010 10:16, BGB / cr88192 wrote: > "Lew"<noone(a)lewscanon.com> wrote in message > news:hsuiua$82f$1(a)news.albasani.net... >> mike wrote: >>>> On the command line I can execute the following: >>>> >>>> java -jar eclipse.jar -application org.eclipse.StandAloneUpdate - >>>> command list >>>> >>>> I want to execute this from within a java [sic] program. >>>> I have added the eclipse.jar in my java [sic] program so that I can >>>> access >>>> the StandAloneUpdate class. >>>> How can I run execute the StandAloneUpdate class with the two commands >>>> ( -command list)? >>>> Use reflection or use system call using ProcessBuilder? All ideas are >>>> welcome. >> >> Eric Sosman wrote: >>> Perhaps I've misunderstood your question, but what's wrong with >>> >>> org.eclipse.StandAloneUpdate.main( >>> new String[] { "-command", "list" } ); >>> >>> ? >> >> or >> org.eclipse.StandAloneUpdate.main( "-command", "list" ); >> > > invalid number of arguments for method 'main'. > cannot convert from String to String[]. > main has no matching definition for (String, String). > ?... > > unless I am wrong ang someone does declare main as: > public static void main(String... args); > > rather than: > public static void main(String[] args); > > unless I have missed something here?... Java since 1.5 allows both. To quote the JLS: <quote> The method main must be declared public, static, and void. It must accept a single argument that is an array of strings. This method can be declared as either public static void main(String[] args) or public static void main(String... args) </quote> Arne |