How to exec command with parameters through runtime.exec()

im trying to run a command prompt passing in parameters. Right now im creating a .bat file like this
c:
cd C:\SOMEDIR
ant deploy moreparameters
and then passing in the file name into the exec command. It is running fine but im trying to use the runtime.destroy() command and it doesnt close the ant command, it only closes the bat file which was already closed. Is there a command I could pass into the exec() method to run the ant command with the parameters without using a bat file?

im getting a CreateProcess: ant deploy -Dswasm=swasm error=2
When i try to do
cmds[0] = "ant";
cmds[1] = "deploy";
cmds[2] = "-Dswasm=all-bs";
Process p = runTime.exec(cmds, null, new File("C:\\Program Files\\apache-ant-1.6.1\\bin"));
its like it cant find ant. But it finds java command fine. What should i pass into the second parameter, it says "If envp is null, the subprocess inherits the environment settings of the current process. " Does that mean it will take the window system enviroment variables? if not what string would i pass in to set where ant is?

Similar Messages

  • How to start microsof access with parameter through runtime.exec

    Hi,
    I try to start access with parameter like this:
    String[] cmd = new String[4];
    cmd[0] = "C:\\Programme\\Microsoft Office\\OFFICE11\\MSACCESS.EXE";
    cmd[1]= "C:\\MyDB.mdb ";
    cmd[2] = "/cmd";
    cmd[3] = "parameter1 parameter2";
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec(cmd);
    However the access mdb startet but it seems not to take the parameter i want to put in to access.
    Have anyone an Idea, what is wrong here?
    Thanks

    Hi
    What do you expect Access to do?
    The /cmd command line option sets the value that is returned by VBA Command function (see http://msdn2.microsoft.com/en-us/library/aa211469(office.11).aspx).
    If you want to start a macro, you would need the /x switch (see http://office.microsoft.com/en-us/access/HA101666051033.aspx).
    Hope this helps
    Christoph

  • How to create messages with parameters In ADF model.

    In ADF model, How to create messages with parameters?

    To Create messages in message bundles with parameters, perform the steps as given below
    Scenario: To Create a message as "Department Name XXXXXXX is already existing "
    Step#1: For the given entity object “DepartmentEO”, Go to “overview” tab and click “Business Rules” finger tab.
    Step#2: Select “Entity Validators” in the list & click “+” to add a new entity level validation rule.
    Step#3: Now go to “Failure Handling” tab, and click the Magnifier Icon.
    Step#4: Now in the “Display Value” field, enter the message with flower-braces as below.
    Department Name {department_name} is already existing
    Step#5: Also modify the Key & Description fields as needed. And click “Save and Select” button.
    Step#6: Now go to “Token Message Expressions” section, double-click the Expression field corresponding to "department_name" & give the relevant Attribute names say "DepartmentName"
    Step#7: Now click “OK”.

  • Runtime.exec command with spaces

    I'm having problems using exec on (unix) commands that take filenames as a parameter - eg chmod.
    The problem is that I've been blessed with some filenames which contain spaces and I can't figure out a way to pass these through.
    The code I'm trying is :
    String fs="/";
    String droot="home";
    String fname="tom test";
    String fullFileName=fs + droot + fs + fname;
    String outlist[] = runCommand("chmod 777 " + fullFileName );
    if fname contains no spaces, then this will work fine, but (as in the example above) if it contains a space, then I get an error (can't find files).
    Any ideas?
    Thanks
    Tom

    The reason that putting quotes around the filename works on the command line is that they affect how the command line interprets them.
    However, Runtime.exec does not intepret the quotes as special characters. If you have a space in an argument, you should use the Runtime.exec method that takes a String[] argument, and place each argument in an array element.

  • Tcp/ip write help - need to send a motor command with parameters

    hello - i have one small, main labview 7.0 vi that i use to control a drill's two motors.
    right now i press a button on the front panel to move the motor, and when i do, a sub vi window pops up so the operator can set a couple of parameters and press an ok button.....the vi then sends the command with the parameters to the drill's motors.
    i am trying to change it so i can send the move command from another computer, in another room, while the main vi sits on the computer with the drill. i know i will use TCP listen, write, read, and close in both the main vi (the TCP server?) and the client which is on the remote computer.
    my problem is with setting the parameters for the subvi's that usually pops up. how do i set the parameters from the remote-client and have them be sent into the subvi on the main vi. if i can do this, i would have to also have a way to close the sub vi after it pops up in the main program too.
    OR should i use something else like and application reference or an invoke node function?????
    please help
    thanks!!!!
    sam

    Hi again,
    If the VI in the lab will be running continuously, then you will need
    to alter some things from the example I sent you or look at an
    alternate implementation. The example I sent you assumed that the VI in
    the lab was not running. This technique actually starts the VI and runs
    it somewhat like a subVI. It inputs values into the connector pane,
    runs it, and then returns values from the outputs on the connector pane
    after it finishes executing. It will not work to call a VI by reference
    if it is already continuously running.
    Instead I imagine you would want to have your VI in the lab have some
    sort of State Machine that polls a certain control value, such as an
    enum control, to determine which state to execute next. You could
    modify the technique I first sent to still open a reference to the VI
    in the lab, but it wouldn't try to run it. Instead you could use the VI
    method Set Control Value to set the value of a certain control or
    controls in the lab VI to certain values. The VI in the lab would then
    hopefully be in some Idle state where it polled one of those control
    values continuously to decide what to do next. That would allow the VI
    in the office to programmatically send commands to the other VI, as
    well as parameters for those commands. Simply set control values for
    the VI in the lab and let the VI in the lab go about its business. I've
    attached an example below.
    That's just one idea. Other options you have would be to use a
    DataSocket connection to send parameters and commands back and forth
    between computers. This is a pretty simple API to use. If you have
    LabVIEW 8, Shared Variables are an option. Or you might look into
    simply using Remote Front panels, which allows you to connect to a VIs
    Front Panel across the network. You could then have the whole VI in the
    Lab, but you could connect to it, view it, modify the controls and so
    on from your office. If you want to view and control a VI without
    having LabVIEW installed on the viewing computer, you can use the Web
    Publishing Tool to create a web interface for your front panel. Lots of
    options. Let me know what sounds interesting.
    Jarrod S.
    National Instruments
    Attachments:
    Lab_VI.vi ‏29 KB
    Office_VI.vi ‏51 KB

  • How to pass command line parameters in calling ant file

    Hi All, I m using a Build file which calls another build file.
    That build file is run from the command prompt by give ant -lib <path of jars it needs for executing>.
    Now i m calling this file from main build file but it does not work as i m not able to set <b>-lib </b>.
    Pls can anybody let me know how to set such command line parameters to call the build file in ant script.
    Thanks in Advance.
    Ketan.B.Parekh

    Create the control file dynamically (and fill one of the columns with the file name as a constant) before you start SQL*Loader
    Another option is to use external tables
    Re: Data Loading
    Message was edited by:
    Jens Petersen

  • How to query Database with Parameters  and configure null value response?

    Hi,
    1.When capture attributes from forms & after applying several logics, passing to a DB table using an API, how to get relevant values for a given parameter in another DB table ?
    2.When a DB table is queried, if the value does not exist, how to configure the response message ?
    Thanks.

    Okay, you've provided exactly what John S. asked for - and no more. This is helpful, but not enough. I think we're going to need a use case to understand exactly what you are asking. What should the user see? What does the user do next? What should happen in the database and in the application when the user does this?
    However, I'll try to read between the lines a bit, and get you part of the way there. To query the database with parameters in ADF BC, you need a View Object (VO). The simplest thing to do is create the SELECT command behind the VO with some bind variables and add the bind variables to your VO. At that point, you will get an ExecuteWithParameters operation in the Data Control. You can drag that operation onto a JSF page and it will give you an option to create a parameter form to let the user fill in the parameters to set the bind variables, and a button to execute the query with these values. Any table or form based on that same VO will show the selected data.
    A Trinidad or ADF Rich Faces table will have an attribute to let you define some text to show the user if no data was retrieved by the query. But there are other ways to determine if data was retrieved which you can use to control other ways to display this information. For instance, I have a page that has an outputText component that has a "rendered" attribute to show the text only when there was no data retrieved by a query.

  • BSM / audit_syslog ... how to get command line parameters in syslog?

    Hi All!
    I have been experimenting with Sun Basic Security Module (BSM) and was trying to send audit data via syslog to a central logging server like so:
    # cat /etc/security/audit_startup
    /usr/sbin/auditconfig -setpolicy +argv,arge
    # cat /etc/security/audit_control
    plugin: name=audit_syslog.so;p_flags=lo,ex,fr,fc,fd,fw,fmThis does produce the desired log output on the central logging server, except that the log lines do not contain command line parameters / environment variables:
    2008-10-14T15:04:26-06:00 csadm4/csadm4 audit: [ID 702911 audit.notice] execve(2) ok session 1576737601 by rem_adm as root:root in csadm4 from csadm1-16.shell.ca obj /usr/bin/lessAs this makes it pretty useless for keeping proper audit records (there is a difference between
    rm ~/file and
    rm /file that I would like to see) I was wondering if there is a way to customize what is actually produced by audit_syslog.so?
    Thanks in advance,
    Rudolf

    No, your plugin doesn't get any access to the command line.  Look for other methods of IAC (COM, DDE, shared memory, shared file, etc.)

  • How to revert commands with "command-S" to cancel system reset

    I've entered the following commands with "command-S" to reset the system:
    mount -uw /
    rm /var/db/.AppleSetupDone
    shutdown -h now
    So now I have the original "welcome" in all languages everytime I turn on the computer. But I want to use my friends original password (he gave me his computer). Is there any way to revert these commands so that it goes to the normal login page when I turn the computer on? Thanks

    You cannot recover a password.  What you can do is create a new administrator account using the process you did, then reset the other password to one you choose.  Log into that account.
    If the computer was protected with Filevault then you can completely forget about recovering anything from that account, unless you have the resources of the CIA or NSA.

  • Problem executing file through Runtime.exec

    Hi,
    i am trying to execute a java programem using the the following line
    Runtime.exec("java Myclass");
    But no response for it.
    Anybody help me.
    Jossy

    As required by forum protocol for people who ask questions about Runtime.exec I am posting the standard link:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • How to hide line console parameters through Cisco ACS

    Hi,
    Can any one of you please help me in the following scenario ?
    I want to hide the line console, line aux and line vty configuration parameters of the cisco devices based on user level privillages through Cisco ACS. For example, if a user logs into the devices with privilege level 7, then he should not be able to see the line paramenters on the cisco devices for which he had privilege level 7 access.
    Can you please help me out how to achieve this?? Your help in this regard is highly appriciated.
    Thanks

    This thing is possible with local authorization on IOS device. With ACS this is not possible.
    In acs you can set what all commands a specific user can issue. That feature is called command authorization.
    For show run you need to give priv 15. ACS works in a different way if you compare it with setting up local priv lvls on router/switch.
    Best way to set it up is to give all user priv lvl 15 and then define what all commands user can execute.
    Note : Having priv 15 does not mean that user will able to issue all commands.
    We will set up command authorization on acs to have control on users.
    This is how your config should look,
    aaa authentication login default group tacacs+ local
    aaa authorization exec default group tacacs+ if-authenticated
    aaa authorization commands 1 default group tacacs+ if-authenticated
    aaa authorization commands 15 default group tacacs+ if-authenticated
    aaa authorization config-commands
    aaa accounting commands 1 default start-stop group tacacs+
    aaa accounting commands 15 default start-stop group tacacs+
    http://www.cisco.com/en/US/products/sw/secursw/ps2086/products_configuration_example09186a00808d9138.shtml
    Regards,
    ~JG
    Do rate helpful posts

  • Problem compiling file through Runtime.exec

    Hi all,
    I execute the following code :
    Runtime r = Runtime.getRuntime()
    Process p = r.exec("javac /home/test/temp dir/helloworld.java");
    The command i give has a directory with space ("temp dir"). Iam not able to run the above code in Linux.
    Kindly help me.
    Thanks in advance.
    Regards,
    Andy

    Runtime.exec have several signatures - use the method that receive String [] as command parameters - it should solve your problem since in every String will be considered as a separate parameter:
    Try the following:
    Runtime r = Runtime.getRuntime();
    String [] cmdArray=new String[2];
    cmdArray[0]="javac";
    cmdArray[1]="/home/test/temp dir/helloworld.java";
    Process p = r.exec(cmdArray);If it still won't work then you will probably need to use a method that receive also the environment.
    HTH

  • Using the IN command with parameters

    I am using .Net with the Oracle 10G client software to connect to a 10G database. I have a package that contains a stored procedure where I need to pass in multiple values to utilize the IN command, but I keep getting a cryptic Oracle error. Basically this is the scenario..
    SELECT * FROM [Table] WHERE ID IN(P_PARAMETER);
    Through my .Net code, I set P_PARAMETER equal to something like "25,31,36,48" without the double quotes. I also tried surrounding each number with single quotes and it still bombed out. Is this valid to do? If not, what are my options since I need to use this scenario (the numbers aren't known ahead of time)?

    may be you are looking for this, you have to use dynamic sql,
    i am using ref cursor to display the data, basically the inlist you are passing is comma seprated as under
    SQL> var c refcursor;
    SQL> var NO VARCHAR2(200);
    SQL>
    ---- this is the in list with comma seprated
    SQL> EXECUTE :NO:='10,20';
    PL/SQL procedure successfully completed.
    -- i am paasing that in list here to procedure
    SQL> CREATE OR REPLACE PROCEDURE test_in (pdno IN VARCHAR2, p_cursor OUT sys_refcursor)
      2  IS
      3       st                            VARCHAR2 (200);
      4       vename                        VARCHAR2 (20);
      5  BEGIN
      6       st         := 'SELECT empno,ename  FROM emp  WHERE dno in ('||pdno||')';
      7       DBMS_OUTPUT.PUT_LINE (pdno);
      8       DBMS_OUTPUT.PUT_LINE (st);
      9       OPEN p_cursor FOR st ;
    10  END test_in;
    11  /
    Procedure created.
    -- calling the procedure
    SQL> EXECUTE  test_in (:NO,:c);
    10,20
    --- this how the statement will look like
    SELECT empno,ename  FROM emp  WHERE dno in (10,20)
    PL/SQL procedure successfully completed.
    printing the out put
    SQL> print :c;
         EMPNO ENAME
          7369 SMITH
          7566 JONES
          7782 CLARK
          7788 SCOTT
          7839 KING
          7876 ADAMS
          7902 FORD
          7934 MILLER
    8 rows selected.
    Elapsed: 00:00:00.00
    SQL> added comment
    Message was edited by:
    devmiral

  • How to pass the report parameters through java not by using URL

    Hello...
    I have an oracle App. Server 10g with report service
    I can the report using the URL :
    http://host:Port/rwservlet/report=....
    and passing the report parameters ...
    But is there any way to call the report by pdf format and passing the parameters from java without using the url ???

    thank you shahcsanjay for your reply
    but I think that web.showDocument can not be used by ordinary java web application ..
    I think it can be used only with with "oracle forms" Am I right ?
    If no can you please tell me where can I find a useful document about how to use web.showDocument ...
    thanks again
    Saleem

  • How to pass command line parameters During server start up

    Hi,
      I am trying to use Net Beans profiling tool.On the server side i required to pass a command line option to enable remote profiling.
    Regards,
    Kiran.

    Hi, MB.
    If you are talking about the automatic Java Web Start support for launching app clients in GlassFish, you can pass the equivalent of command line arguments using the query string of the URL you use to launch the app client.
    Briefly, use
    http://host:port/client-path?arg=first-arg&arg=second-arg& ...
    specifying the argument values in the order that you want them passed to the client.
    The GlassFish server will do the right thing and generates the correct JNLP so your arguments are passed to the app client.
    The GlassFish developer's guide http://glassfish.dev.java.net/nonav/javaee5/docs/AS91DG.pdf discusses this and all aspects of the Java Web Start support. You can also take a look at this blog entry http://blogs.sun.com/quinn/entry/command_line_arguments_and_properties that focuses on how to pass arguments.
    Since this technique deals with argument passing in the URL, it works no matter how you launch the app client: a URL in a browser, the javaws command, etc.
    - Tim

Maybe you are looking for

  • Where did the live chat button go?

    I wanted to get someoen on the live chat option to check my xbox one pre-order like i did last week and now that button is gone.... my order says payment validated but the status says not available.

  • Network-crashing problem

    Hi I've got problem with my network connection. I've been looking through arch forum, wiki, google, but usually people have slightly different problem. Some of my config files: /etc/rc.conf MOD_AUTOLOAD="yes" MOD_BLACKLIST=() MODULES=(p4-clockmod cpu

  • Photosmart 7520 Horrible Print Quality

    I have purchased HP printers for years and have always considered them excellent and reliable products. About a year ago I purchased a Photosmart 7520. This has turned out to be the worst printer I have ever owned.The print quality is terrible and un

  • How to find out where a Compound clip is being used

    I've created a dummy Compund Clip just to test FCPX doesnt allow me to delete - it says its being used I cant remember where I used it How do I found out where it's being used? Thanks Omar

  • Search for a string in SAP Script

    Hello Experts, Is there a way to search for a string in all Z SAP scripts, like ABAP source scan? Regards, Hari.