Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Runtime.getRuntime().exec() append the parameters

Reply
Thread Tools

Runtime.getRuntime().exec() append the parameters

 
 
balaguruthangaraj@gmail.com
Guest
Posts: n/a
 
      04-20-2009
String[] command = new String[] {"CSCRIPT", vbsFile , "arg1" ,
"arg2"};
Runtime.getRuntime().exec(command);

and

Runtime.getRuntime().exec("CSCRIPT vbsfile arg1 arg2");

In the above code arg1 and arg2 are append when I got these arguments
in vbsfile.
But When I excute the same in command prompt it works fine.
Is anybody face this issue?
 
Reply With Quote
 
 
 
 
John B. Matthews
Guest
Posts: n/a
 
      04-20-2009
In article
<(E-Mail Removed)>,
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> String[] command = new String[]
> {"CSCRIPT", vbsFile , "arg1" , "arg2"};
> Runtime.getRuntime().exec(command);
>
> and
>
> Runtime.getRuntime().exec("CSCRIPT vbsfile arg1 arg2");
>
> In the above code arg1 and arg2 are append when I got these arguments
> in vbsfile.


I don't understand what difference you are seeing. Can you paste a
verbatim transcript of your results? Is your OS case sensitive? [vbsFile
versus vbsfile]

> But When I excute the same in command prompt it works fine.
> Is anybody face this issue?


Are your actual arguments correctly quoted so that they may be "broken
into tokens using a StringTokenizer," as discussed here:

<http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html>

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
 
Reply With Quote
 
 
 
 
Lothar Kimmeringer
Guest
Posts: n/a
 
      04-21-2009
(E-Mail Removed) wrote:

> In the above code arg1 and arg2 are append when I got these arguments
> in vbsfile.
> But When I excute the same in command prompt it works fine.
> Is anybody face this issue?


What exactly are the values of arg1 and arg2. If they contain
wildcards or other things that are interpreted by the command-
interpreter working in a command shell, you have to call that
command-interpreter from Java instead of calling cscript.

Also you might make sure that cscript and/or your Visual Basic
file are not relying on environment variables that are not set
within your Java-process.

This is all I can tell without knowing more about the calling
parameters and error-messages that are returned from the
called process.


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (E-Mail Removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 
Reply With Quote
 
balaguruthangaraj@gmail.com
Guest
Posts: n/a
 
      04-25-2009
Hi,

There was no error message on this.
The vbs script was executed , so no necessary to set environment
variables for this.
arg1 and arg2 have no wildcards just alphabet only.
Note that It does not happen at all time.Some time it succeed some
time the parameters appends.

Machine details:

Processor: Intel Xeon Cpu E5420 @2.50Ghz
OS: Windows Server 2003 Standard SP2



On Apr 21, 4:53*pm, Lothar Kimmeringer <(E-Mail Removed)>
wrote:
> (E-Mail Removed) wrote:
> > In the above code arg1 and arg2 are append when I got these arguments
> > in vbsfile.
> > But When I excute the same in command prompt it works fine.
> > Is anybody face this issue?

>
> What exactly are the values of arg1 and arg2. If they contain
> wildcards or other things that are interpreted by the command-
> interpreter working in a command shell, you have to call that
> command-interpreter from Java instead of calling cscript.
>
> Also you might make sure that cscript and/or your Visual Basic
> file are not relying on environment variables that are not set
> within your Java-process.
>
> This is all I can tell without knowing more about the calling
> parameters and error-messages that are returned from the
> called process.
>
> Regards, Lothar
> --
> Lothar Kimmeringer * * * * * * * *E-Mail: (E-Mail Removed)
> * * * * * * * *PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)
>
> Always remember: The answer is forty-two, there can only be wrong
> * * * * * * * * *questions!


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
skipping template parameters inside template parameters kito C++ 2 09-26-2010 12:04 AM
the address of list.append and list.append.__doc__ HYRY Python 10 09-26-2007 09:41 AM
Class Member Data and Member Function Parameters - Should Parameters Be Data Members? Jason C++ 2 05-13-2006 07:11 AM
does a "parameters"-parameter overwrite the "parameters"-object? Florian Loitsch Javascript 11 03-15-2005 03:33 PM
Servlet parameters different from the command line parameters? Jonck van der Kogel Java 2 05-26-2004 11:34 PM



Advertisments