Command line commands

Is there any class in the default java SDK for executing command line commands? I've been looking in the API but have been unsuccessful so far.
Thanks.

when i execute the command, the process created goes for half a minute or so, but the java program just ends straight away.
is there any way to keep the java program open as long as the process is still running?

Similar Messages

  • Command line command for combine jpeg files into a pdf file

    I want to learn if we have any command line sentence to combine jpg files.
    normally from the windows explorer window
    i can select all jpg files and when i click on right button on the window they shows Combine supported files in acrobat and then i check if single file is selected and i clicked on combine files button.
    and then i put name of the file and press the save button.
    But i want to process this steps via command line commands.
    Can you show any answer to me.

    You don't say what version of Acrobat you are using, but I expect you could do it with Acrobat XI's Actions feature. Maybe even in 10.0. Since this is an enterprise deployment forum, I suggest you find a better forum and ask about Actions and Batch Processing.
    hth,
    Ben

  • HiQ doesn't execute scripts and command line commands

    I am running HiQ pro 4.5 on Windows 2000 SP 2. Whenever I enter a command line command, e.g. "1+1", HiQ reports "no error reported" and doesn't execute the command. When I enter the same command again, HiQ tells me that a semicolon is missing.
    When I try to execute a script, HiQ reports "Fatal Script error on line -1".
    Anybody knows this behaviour and how to get HiQ running normally?

    I do have the same problem.

  • Issue with variables and white space in powershell script that calls a command line command

    Guys,
    I have a question regarding this script. Each time I run it, it creates the share, but with a space after it. Also I need help figuring out how to put in the variable for the folder path.
    Below is the code
    $Users=Import-Csv C:\users2.csv
    foreach($User in $Users){
         $User.SNCORP
         $User.HPB
         $User
         cmd /c "net share "$User.SNCORP"=D:\Users\"$User.HPB" /grant:Everyone,FULL"
    The csv file looks like this
    HPB,SNCORP
    ccarter,carterch$
    This is my output in powershell
    PS C:\> .\shareflip.ps1
    carterch$
    ccarter
    HPB                                                         SNCORP
    ccarter                                                     carterch$
    The syntax of this command is:
    NET SHARE
    sharename
              sharename=drive:path [/GRANT:user,[READ | CHANGE | FULL]]
                                   [/USERS:number | /UNLIMITED]
                                   [/REMARK:"text"]
                                   [/CACHE:Manual | Documents| Programs | BranchCache | None]
              sharename [/USERS:number | /UNLIMITED]
                        [/REMARK:"text"]
                        [/CACHE:Manual | Documents | Programs | BranchCache | None]
              {sharename | devicename | drive:path} /DELETE
              sharename \\computername /DELETE
    Any help is greatly appreciated. 
    Christopher

    There is no need to use cmd /c. You should be able to use:
    net share "$($User.SNCORP)=D:\Users\$($User.HPB)" "/grant:Everyone,Full"
    Use showargs.exe (from the article) at the beginning of this line to see the command line PowerShell is actually running (very useful for troubleshooting).
    -- Bill Stewart [Bill_Stewart]

  • How we run command line commands in oracle

    Hi,
    In sql server i have an option "xp_cmdshell" i can run windows commands e.g "dir " using query analyzer.
    How can i do same thing in oracle
    Thanks in advance.
    Regards
    Faheem

    > MY SELECT:select OSexec('dir') as STDOUT from dual;
    ERROR:-1command[dir] The handle is invalid.
    In the sample code, I've executed a Linux/Unix program called date, physical file /usr/bin/date.
    Is there a DATE.EXE or a DIR.EXE program that you can execute on Windows?
    No. Both DATE and DIR are commands of a program - a 32bit console program called CMD.EXE.
    Your confusion stems from thinking that OSEXEC is calling the Windows shell command line. It is not. It is not calling CMD.EXE and passing Window Shell Commands to CMD.EXE.
    OSEXEC is calling, via Java, the Win32 API call called CreateProcess(). This is a call to the Win32 kernel. It requests the kernel to load an executable program as a process image.
    The kernel expects an EXE (or executable) file to load. You are passing it a command from a program. You just as well can pass it a Java command, a MS Access Basic Command, an Excel Macro, etc... Same thing. The kernel has no idea that this "command" needs another program to be loaded, and that command be "passed" somehow to that program.
    So, you need to call CMD.EXE via OSEXEC. And you can pass parameters to it. Open a Command Console and type cmd /? for help on the command line switches and parameters for CMD.EXE.
    I believe the following should work:
    SQL> select OSEXEC( 'c:\windows\system32\cmd.exe /c date /t') from dual;

  • Parsing commands from a command line, command-pattern?

    I'd like to create a command line where user type their commands and the application will invoke the appropriate action. There could be many commands with different arguments.
    example:
    FDA G 1033052
    XXLD TA 93843234 G 928322
    etc
    each command has different arguments and each command should perform a db task (it's long).
    Also, the commands can be undo (eg, if user clicks UNDO it will undo the last command)
    for this I realized I need to build the command pattern (hold a stack of all commands) but I'm still debating with some issues:
    1. What parser should I build in order to execute the command
    2. How should I encapsulate the commands in a way that will be easier to invoke, should I add all commands in the beginning to a map where the first argument will be the key and the value will be the class?
    Thank you
    Edited by: xianwinwin on Oct 29, 2009 2:22 AM

    xianwinwin wrote:
    I'd like to create a command line where user type their commands and the application will invoke the appropriate action. There could be many commands with different arguments.
    example:
    FDA G 1033052
    XXLD TA 93843234 G 928322
    Commands like that are going to be error prone for human users.
    etc
    each command has different arguments and each command should perform a db task (it's long).
    Also, the commands can be undo (eg, if user clicks UNDO it will undo the last command)
    for this I realized I need to build the command pattern (hold a stack of all commands) but I'm still debating with some issues:
    1. What parser should I build in order to execute the commandFor the posted examples the parser is trivial - break on space. Validation might be harder.
    2. How should I encapsulate the commands in a way that will be easier to invoke, should I add all commands in the beginning to a map where the first argument will be the key and the value will be the class? You are creating a language. How you interpret the language depends on the definition of the language and specifics of the implementation.
    You could certainly do it as you suggest but there are many other variations as well.

  • Unable to execute command line command in java

    I am trying to run a command to add a group name. It is executed in command prompt of Windows 2003/2000
    Say this is the command I want to execute:
    net localgroup LordSM /add
    Here LordSM is the group name.
    I wrote the following code but it does not seem to work. Please suggest.
    String ABC=Value1TextField.getText();
    Value2Label.setText("Value is now " + ABC);
    // Above is to get value from a JText Field
    // Below is the code to run command for adding a group name to a System.
    String ExecutedCmd = "net localgroup " + ABC + "/add";
    Process p = Runtime.getRuntime().exec(ExecutedCmd);
    BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
    BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
    // read the output from the command
    System.out.println("Here is the standard output of the command:\n");
    while ((s = stdInput.readLine()) != null)
    {                System.out.println(s);             }
    // read any errors from the attempted command
    System.out.println("Here is the standard error of the command (if any):\n");
    while ((s = stdError.readLine()) != null)
    {       System.out.println(s);           }

    It does not seem to work means, that no Standard Error is defined, when it executes and group name is not added as well. The following is JUnit Test Result: Hope it gives a better:
    compile:
    run:
    Here is the standard output of the command:
    Here is the standard error of the command (if any):
    The syntax of this command is:
    NET LOCALGROUP [groupname [/COMMENT:"text"]] [DOMAIN]
    groupname {ADD [/COMMENT:"text"] | /DELETE} [DOMAIN]
    groupname name [...] {ADD | /DELETE} [DOMAIN]
    Got it
    BUILD SUCCESSFUL (total time: 10 minutes 49 seconds)
    I had even tried this:
    Runtime rt =Runtime.getRuntime();
    String[] cmd = new String[3];
    cmd[0] = "cmd.exe";
    cmd[1]="net localgroup";
    cmd[2] =ABC + "/add";
    rt.exec(cmd);
    but again, it does not give any error as such, but it does not create the group name either. Please suggest. We can see the group names that are added on right clicking My Computer Icon and click Manage and then go to User & Group section. On executing either of the code nothing happens.
    Thanks

  • Unable to execute a command line command using Java

    I am trying to run a command to add a group name. It is executed in command prompt of Windows 2003/2000
    Say this is the command I want to execute:
    net localgroup LordSM /add
    Here LordSM is the group name.
    I wrote the following code but it does not seem to work. Please suggest.
    String ABC=Value1TextField.getText();
    Value2Label.setText("Value is now " + ABC);
    // Above is to get value from a JText Field
    // Below is the code to run command for adding a group name to a System.
    String ExecutedCmd = "net localgroup " + ABC + "/add";
    Process p = Runtime.getRuntime().exec(ExecutedCmd);
    BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
    BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
    // read the output from the command
    System.out.println("Here is the standard output of the command:\n");
    while ((s = stdInput.readLine()) != null)
    { System.out.println(s); }
    // read any errors from the attempted command
    System.out.println("Here is the standard error of the command (if any):\n");
    while ((s = stdError.readLine()) != null)
    { System.out.println(s); }
    I am trying to run a command to add a group name. It is executed in command prompt of Windows 2003/2000
    Say this is the command I want to execute:
    net localgroup LordSM /add
    Here LordSM is the group name.
    I wrote the following code but it does not seem to work. Please suggest.
    String ABC=Value1TextField.getText();
    Value2Label.setText("Value is now " + ABC);
    // Above is to get value from a JText Field
    // Below is the code to run command for adding a group name to a System.
    String ExecutedCmd = "net localgroup " + ABC + "/add";
    Process p = Runtime.getRuntime().exec(ExecutedCmd);
    BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
    BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
    // read the output from the command
    System.out.println("Here is the standard output of the command:\n");
    while ((s = stdInput.readLine()) != null)
    { System.out.println(s); }
    // read any errors from the attempted command
    System.out.println("Here is the standard error of the command (if any):\n");
    while ((s = stdError.readLine()) != null)
    { System.out.println(s); }
    It does not seem to work means, that no Standard Error is defined, when it executes and group name is not added as well. The following is JUnit Test Result: Hope it gives a better idea of the problem I am facing:
    compile:
    run:
    Here is the standard output of the command:
    Here is the standard error of the command (if any):
    The syntax of this command is:
    NET LOCALGROUP [groupname [/COMMENT:"text"]] [DOMAIN]
    groupname {ADD [/COMMENT:"text"] | /DELETE} [DOMAIN]
    groupname name [...] {ADD | /DELETE} [DOMAIN]
    Got it
    BUILD SUCCESSFUL (total time: 10 minutes 49 seconds)
    I had even tried this:
    Runtime rt =Runtime.getRuntime();
    String[] cmd = new String[3];
    cmd[0] = "cmd.exe";
    cmd[1]="net localgroup";
    cmd[2] =ABC + "/add";
    rt.exec(cmd);
    but again, it does not give any error as such, but it does not create the group name either. Please suggest. We can see the group names that are added on right clicking My Computer Icon and click Manage and then go to User & Group section. On executing either of the code nothing happens.
    Thanks

    Duplicate post:
    http://forum.java.sun.com/thread.jspa?threadID=5203526&messageID=9812067#9812067

  • Airport affect command line commands, such as telnet, route -v get, etc.

    I am experiencing a special problem when I both connect to internet through Airport and my private network through ethernet port.
    When Airport is connected to internet, I connect the ethernet port to an internal private network, where I did not set default gateway for this private connection.
    When I tried to "telnet" to an ip within the same subnet of the internal private network, there is none of any response. From wireshark capture, there is none of any packet sending out. But when I tried both "icmp ping" and "ftp", they both worked properly.
    Then I disconnect Airport and try "telnet" again, it then worked quickly.
    In addition, when I try to check the route to my destination, which is within the same subnet of my ethernet, I used "route -v get 192.168.133.219". Interestingly, when Airport was not connected, this command will output the route information quickly. However, when Airport was connected, this command will not have any output of the route.
    I have updated to the latest 10.5.8 release, but still have the same problem.
    Have you ever had experienced such problem? Normally how can I report bug like above to Apple?

    After properly configured VMware, this problem has been resolved.

  • What is the Unix command line command to reformat the internal 3 tera fusion drive in my 5k retina 27 iMac ?

    there seems to be problems with Yosemite and boot camp assistant
    i'm cross posting this to the iMac forum but I spent hours online with apple tech today and none of the several foks I talked to there had even seen a 5k 27" yet and my call back from Cupertino and engineering is no till tomorrow so I thought I should post here too
    MMy bto 5k shipped from China sunday night and arrived in Maine this morning.... Amazing when you think about it for a bto
    iinstallation and set up we're going fine and I started up boot camp assistant to create  a temp boot camp while I wait for my thunder bay 4 box to take the drives for my old Mac pro when boot camp will have a1 tera SSD all to itself....
    so carved off a 700 gig boot camp partition which the assistant formatted fat I then plugged is the lighting to FW adapter in a LaCie 2 tera fw 800 drive to act as a bridge to my LaCie DVD burner which uses the old fw400 cables and inserted my new shrink wrap win 8.1 retail 64 DVD and up comes the win 8 install in very tiny type in a tiny window which got a bit of a laugh out of me.
    And I go through it to the point of selecting that boot camp partition and then said it could not use a fat partition and I should reformat it from the win 8.1 installer which I did and then it said it could not use and unknown partition so I said great and booted back to 10-10 and the boot camp tool to put things back and it said it could not I then went to disk tools and it also said the  3tera fusion could not be either reformatted or put back to a single partition I was on with tech support where I went up through 4 levels of support due to the 5k bto which most had no knowledge of. We tried the optioncommand r to get to DT and the same problem as did going to reinstall from the net which after a 30 min down load could not reformat either it is now kicked to Cupertino with a call back tomorrow
    ( At this point all I want to do is put the computer back in the condition it was in when i started with a plain Yosemite on an unpartitioned 3 tera fusion... Then deal with boot camp when it can have its own drive)
    am betting it will take a Unix comand line to reformat but be aware there may be boot camp issues with my configuration
    and  any help here will be great fully received

    Try booting into Internet recovery mode, ⌘⌥R, launch Disk Utility to erase the HD. If successful, reinstall the OS. If not, then return it (14 days with no questions asked) and get another machine. Apple sells it and they should know how to fix it.
    27" i7 iMac (Mid 2011) refurb, OS X Yo (10.10), Mavs, ML & SL, G4 450 MP w/10.5 & 9.2.2

  • Running command line commands through java

    How do I run other programs through Java and capture their output. E.g. If I want to capture output of 'ls *.txt' what do I do ? If you can paste some sample code or point me to some tutorial that would be cool.
    Thanks,

    I tried that
    Process proc = Runtime.getRunTime().exec("curl " + query);
    but now what. From the documentation I could see that
    public abstract OutputStream getOutputStream()
    might be helpful. But then which OutputStream class to use ? I am looking for a coding example. If you could paste it, that would be great.

  • Access via command line to the data files for Address Book

    Snow Leopard Server 10.6.8
    Mac Mini 2.66 GHZ Intel Core 2 Duo 4 GB 1067 MHZ DDR3
    I rolled back from Mountain Lion Server to Snow Leopard Server because I needed mySql. At the time I was under AppleCare and they walked me through the steps. However, I ended up with Address Book issues.
    Addressbook user on the Snow Leopard Server was upgraded to Mountain Lion Server. During the rollback process, the Apple tech had me delete the Addressbook user.
    When we finished the rollback, he had me recreate the Addressbook user, but now it is linked to a new, empty data file. I cannot add new contacts nor edit or delete them. So I need to use the command line to view both data store files, find the one that has my data in it and re-attach it to my new Addressbook user.
    Can someone help me with the Command Line commands?
    Thank you,
    Cailyn

    Hi,
    There are a couple of more advanced solution I can think of and I'm actually working on one myself.
    * You can create your own jnlp client that allows you to pass in arguments. That sounds harder than it easy. Building a stripped down jnlp client (e.g. no installer, no applets) using one of the two open-source client as a start takes probably just a couple of days and should be sufficient for in house usage.
    * Another solution is what I'm working on now. You can wrap your own executable around javaws that takes your passed in arguments plus jnlp href and looks up the original in the cache and adds a new one to the cache that it passes on to javaws and suddenly everything works as it should. The magic will be revealed at http://www.geocities.com/vamp201
    - Gerald Bauer

  • Windows command line

    Is thee any way to use java to process Windows command line commands, such as running ftp?

    Runtime.exec() is used to run system commands, but it's not a command-line shell. Before you try to use it, you should read the following: Navigate yourself around pitfalls related to the Runtime.exec() method
    If you're looking for an FTP API in Java, you should try the Jakarta Commons Net packages...

  • Command line build problem

    We have a large help project I'm migrating to RoboHelp 6
    (nearly 3000 topics, 12 chms plus a master file). We generate using
    a script that calls the command-line option. One of the projects
    fails during command line processing, even though I can build it
    from within the GUI without fail. When I run the command line
    command, this is the message that is returned:
    "D:\quartus\robohelp\subs\reference>"d:\Adobe\RoboHelp
    6.0\RoboHTML\RHCL.exe" reference.xpj
    Adobe (R) RoboHelp Project Command Line Compiler version
    6.00.099
    Copyright (C) 2006 Adobe Macromedia Software LLC. All rights
    reserved.
    Project: D:\quartus\robohelp\subs\reference\reference.xpj
    Layout: Microsoft HTML Help.
    Output: D:\quartus\robohelp\reference.chm.
    Scanning project for compilation....
    Error: Failed to scan all the project files. Please use
    RoboHelp to recover the project.
    Unexpected Error: Failed to prepare single source data for
    RHCL. Please try to compile it in RoboHTML."
    If I open the project in the GUI and compile it, then compile
    from the command line, it works fine. But if I clear the directory,
    run the NGCMD.exe command and get the files out and run the
    RHCL.exe, I get the same error message.
    Thanks

    Finally I figured out this problem.
    It is because one .fpj file missing in the image folder.
    When I was using X5, there is no image.fpj in the image
    folder, but after upgrading to RH6, using the command line compiler
    will fail if there is no the .fpj file under the image folder.
    Checking in the image.fpj to the server, then check it out to
    your build machine, everything is OK now.
    AG2MM

  • How to run the Quick Repair in Uninstall a Program from the command line

    Hello everyone.  Right now we're manually going onto machines and opening Control Panel, Uninstall a Program, then doing a Change on our Office 365 2013 installs to run the Quick Repair option.  Is there a better way to do this with a command line
    command (that only references local files on the machines), or just issues the same exact command that our manual intervention described above does? 
    We have the click to run version installed also if that matters.

    Hi,
    To run a Quick Repair for 64-bit operating systems:
    “C:\program files\Microsoft Office 15\ClientX64\integratedoffice.exe” RUNMODE RERUNMODE modetorun repair
    To run a Quick Repair for 32-bit operating systems:
    “C:\program files\Microsoft Office 15\ClientX86\integratedoffice.exe” RUNMODE RERUNMODE modetorun repair
    Note: The above commands need to be run from an elevated command prompt.
    For more information, please refer:
    http://blogs.technet.com/b/office_resource_kit/archive/2013/06/17/automating-quick-repairs-in-office-365-proplus.aspx
    Hope this helps.
    Regards,
    Steve Fan
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please click
    here

Maybe you are looking for

  • Adobe interactive form-submit button is not working

    hai guys,   i am following the example in sap technical. i have created the adobe form in webdynpro for abap applaiction. but the submit button doesnt work .(it doesnt trigger the break point set in on action method).. reading other threads,i verify,

  • 'Windows is not genuine' after i had HDD re-placed

    I recently replaced my hard drive as it had failed, and when it was repaired the windows product key was lost. I cant find the cd/manual with the key on it ( if that's where it is ) and the product key on the bottom of the laptop HAS RUBBED OFF !! (c

  • Workflow step in status "In Process"

    Hi Friends, I am working on SAPXI support project. Actually i have an issue related with BPM, there is a workflow(wk) which is completed but the one of the step in this wk is status "In process", but i can see all the steps in this wk are either comp

  • How do I change the color of the font of the page name?

    Thank you guys:)

  • Actual start date in order

    In any of my order type i cant see actual start and actual finish date and it remains blank though order gets completed. Wat can be a possible reason or is there any specific settings for that ???