Command to end a program

i am creating a program to run various commands. I have added an option where i want the program to end if the user types exit.
does anyone know the command that i need that will actualy close the program

if else ?
if the user enter "exit" then exit the program system.exit()

Similar Messages

  • Running curl command from a java program using Runtime.getRuntime.exec

    for some reason my curl command does not run when I run it from within my java program and errors out with "https protocol not supported". This same curl command however runs fine from any directory on my red hat linux system.
    To debug the problem, I printed my curl command from the java program before calling Runtime.getRuntime.exec command and then used this o/p to run from the command line and it runs fine.
    I am not using libcurl or anything else, I am running a simple curl command as a command line utility from inside a Java program.
    Any ideas on why this might be happening?

    thanks a lot for your response. The reason why I am using curl is because I need to use certificates and keys to gain access to the internal server. So I use curl "<url> --cert <path to the certificate>" --key "<path to the key>". If you don't mid could you please tell me which version of curl you are using.
    I am using 7.15 in my system.
    Below is the code which errors out.
    public int execCurlCmd(String command)
              String s = null;
              try {
                  // run the Unix "ps -ef" command
                     Process p = Runtime.getRuntime().exec(command);
                     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);
                     return(0);
                 catch (IOException e) {
                     System.out.println("exception happened - here's what I know: ");
                     e.printStackTrace();
                     return(-1);
         }

  • Running a perl shell command through a java program on linux platform

    i'm trying to execute the following command in a java program "perl xxx.pl" using the runtime.getruntime method
    here is the piece of code
    String[] cmd={"perl","-c","AraMorph.pl",""};
    Process p = Runtime.getRuntime().exec(cmd,null,new File("/home/ahmed/buckwalter_morphan_1/data"));
    p.waitFor();
    BufferedReader in=new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line;
    while ((line=in.readLine())!=null)
    System.out.println(line);
    but it doesn't output anything even if i tried to print the output to a file
    i'm trying to execute this program on linux platform but its working properly on a windows platform
    thx
    raar

    String[] cmd={"perl","AraMorph.pl"," </home/ahmed/in.txt"," >/home/ahmed/ast.txt"};
    Process p = Runtime.getRuntime().exec(cmd,null,new File("/home/ahmed/buckwalter_morphan_1/data"));
    BufferedReader in=new BufferedReader(new InputStreamReader(p.getErrorStream()));
    String line;
    while ((line=in.readLine())!=null)
    System.out.println(line);
    p.waitFor();
    String str2=p.getInputStream().toString();
    System.out.println("==================================="+str2);
    and it still outputs nothing but goes in something like infinite loop or as assumed in the article u suggested a deadlock but even all solutions to all pitfalls didn't succeed

  • Could not complete the Crop command because of a program error - Win 7

    So I use PS CC everyday for cropping out images from design mockups for websites.
    Yesterday (1 April 2014) I got a new comp from the designer with some updated images. So I opend the comp, and began to setup the cropped area with my guides. I then grabbed the marquee tool and made my selection, clicked Image->Crop, and then I get an error message.
    "Could not complete the Crop command because of a program error."
    Well that is helpful.
    So now its "Help me Google, you're my only hope.", after about an hour or so of searching this error I find that it mostly happens to Mac users. I am using Windows 7. I also find that people are trying to get information form a PSErrorLog.txt file that is suppsoed to be located in the "Preferences Folder"... again I am on Windows 7.
    So more searching to find the Windows eqivelant of this file's location: C:\Users\{USERNAME}\AppData\Roaming\Adobe\Adobe Photoshop CC\Adobe Photoshop CC Settings
    Only to find there is no PSErrorLog.txt file. I do have a sniffer-out.txt file and a bunch of .psp files, a SynchFiles folder and 2 Workspaces folders (one Modified).
    So I say to myself, "Well, I have cloud and a fast connection, won't take long to reinstall." So I delete PS ( I am also runnig DW, FL, Br, and AI ), and PS only. I do not run the cleaner tool as it only wants to delete a PS driver, or EVERYTHING!, which I do not want to do, I just want to delete PS. So I delete PS and check for anything left behind (why is there always stuff left behind? Apparently DELETE really means "Only delete some parts of the app that are required to make it work, and leave the rest behind.", or something.). Anyway, I then reinstall, go to crop again, and get the same error.
    So here I am, "Help me Adobe Forums, you're my only hope."

    Mylenium,
    You are correct. But none of that information, or those parameters, have ever had any effect on cropping anything in PS before. I crop vector smart objects brought in from AI all the time. In this case, yes the layers I am trying to crop are vector smart objects, which I rasterized and merged, then resaved the document and still get the same issue.
    But, going off of your suggestion, I did flatten the image completely and I am now able to crop it without error. I suspect that there is something else in the layers that maybe causing this issue, as you have mentioned.
    Thank you for your input, while you may not have known it, you gave me at least somewhere to start to try and figure out what is happening.

  • Could not complete the Refine Edge command because of a program error.

    This is kind of me being a smart ***… but, I’ve found an Error with the new refine edge. And I’ve solved the problem:
    If you check “remember settings” and refine a selection with output set to “New Layer with Layer Mask” and then try and refine another selection when you have an adjustment layer selected, the “New Layer with Layer Mask” is greyed out, but unless you change the output setting to something not greyed out, you get the error "Could not complete the Refine Edge command because of a program error.”.
    I’m sure there’s a better place I could have posted this and all that, but there you have it.
    Oh, and the solution is to just change the “Output to” to something not greyed out.

    Without system information and details on what exactly you are trying to do like what channel/ mask/ slection you are trying to refine in what specific image nobody can really say anything. Such errors are always specific. It would be best if you provided a screenshot of the selection in the image.
    Mylenium

  • "Could not complete the "...."command because of a program error" PE10, Windows 7, 64 bit

    I have just done a clean re-install of  PE10 on my windows 7, 64 bit desktop because I was getting the "Could not complete the "...."command because of a program error" message every time I try to do anything to my file such as applying a filter, enhance or anything. After I re-installed it, I still am getting the same results, making it completely useless. I do not use PE10 often, as I use Lightroom 5.3 almost exclusively for my picture manipulations, but I do need it for some purposes. Please help.

    "...create a new layer by selecting the new layer icon at the bottom of the layers pallet..."
    That produces a blank layer. With this blank layer selected, you should get the message "Could not complete the command because the selected area is blank".

  • **Error** Scene 1, Layer 'actions', Frame 1, Line 664: 1087: Syntax error: extra characters found after end of program.

    Scene 1, Layer 'actions', Frame 1, Line 664: 1087: Syntax
    error: extra characters found after end of program.
    I am new to importing classes and I have been practicing
    making a photo gallery. I am stuck and I want to know if someone
    can help me with the error I am getting.
    If it is convenient, you can download and test my .zip at
    www.dhtmlguy.freeservers.com
    Thanks in advance!

    thanks...the small stuff gets me every time.

  • Execute a command in an external program.

    Hi all,
    I have a little question. I want to execute a command (ctrl+F1) in an external program. This program is already open, so i dont need to execute it. Is there a way to get the focus in this program and automaticly execute my command? I have checked around and all i found was how to execute the program.
    Thanks alot
    Alex

    I want to execute a command (ctrl+F1)Thats a key stroke, not a command.
    in an external program.I always ask this, but what is an internal program?
    Is there a way to get the focus in this program and automaticly execute my command?Kind of. java.awt.Robot provides methods to simulate mouse and keyboard events. If you know where the window is on the screen, you could focus it using the Robot (move the mouse over it and click) and then issue a key event.
    Not too easy.

  • How to run a openssl command from a java program

    Hi All
    Please suggest on how to run a openssl command from a java program.
    I am using this
    Runtime runtime = Runtime.getRuntime();
    runtime.exec("openssl pkcs8 -inform der -nocrypt test.der result.pem");
    This is suppose to take test.der as input and create result.pem.
    There are no errors but the file result.pem isnt created.
    Thanks in Advance

    First off is that openssl command correct? Should it be this instead:
    openssl pkcs8 -inform der -nocrypt -in test.der -out result.pem
    Try out your openssl command within a command prompt so that you know that it works ok. I think the command line you specified waits on stdin (well it does for me).
    After that.....
    runtime.exec creates a Process object. If you do this:
    Process openssl = runtime.exec("....")
    then you can examine the return code from openssl to see the exit code - for instance if the input file does not exist then exit = 1. You can test for this with Java
    Alternatively you could get the stderr from the process and look inside it - if it is 0 length then all is good, if it has some text in there then it has likely failed. You could then throw an exception and include the stderr output in the exception messgae. You may need to experiment with this, runnig it first when openssl is happy then running it again when openssl is upset.
    M

  • Error 1087 extra characters found after end of program.

    Why am I getting the "error 1087 extra characters found after end of program with this code".
    If (counter == 1) {
    Next_btn.addEventListener(MouseEvent.CLICK,KMT1);
    else {
    Next_btn.addEventListener(MouseEvent.CLICK,KMT1);
    function KMT1(event:MouseEvent):void {
      gotoAndPlay("KMT1");

    thanks...the small stuff gets me every time.

  • Photoshop CC "Coluld not complete the levels command because of a program error"

    Hope somebody can help me resolve this issue. A month ago I began to use Creative Cloud as a trial mode. Two days ago I bought a Creative Cloud licesnce. Since that a message "Coluld not complete the levels command because of a program error" start to appear every time I use any command (Levels, HUE, etc.) and I can not work with Photoshop anymore.
    Thanks Edward

    Did it work well with trial?  It is same program as you bought.
    When you bought the licence did you just enter serial number into trial, or install another copy?  If the latter unistall the trial.

  • PSE 5 Error "could not complete the open command because of a program error"

    I have been using PSE 5 for years but all of a sudden when I try to open multiple files "could not complete the open command because of a program error" appears.  I have reformatted my computer and reinstalled all programs & updates but still get the error.  I am trying to access photo files in a specific, user created, directory on my computer; the funny thing is that if I access files in the My Documents\My pictures\ Sample pictures folder I am able to open all the files.  Any and all help or suggestions are welcome.  Thanks

    When you choose liquify command it says "Could not complete the Liquify command because of a disk error." so nothing at all happens other than the error message
    There is plenty of room on my scratch disks --lots of it
    Tried using a smaller selection using Marquee Tool to outline a smaller area near where I want to Liquify.  makes no difference.  tried a small file as well.  no ability to use liquify.
    This is really weird.
    keep probing the depths of your mac ideas, as I am going a bit nuts with this, friends

  • 1084: Syntax error: expecting rightbrace before end of program.

    So I'm doing this basic coding thing to make an object "shoot" bullets. It's from a tutorial video. My code matches his exactly unless I'm missing a tiny detail. Basically the code looks like this:
    package {
    import flash.display.Sprite;
    import flash.events.Event; 
    public class bullet extends Sprite {
    private var sw:Number;
    private var sh:Number;
    private const _SPEED:int=-10;
    private const _OFFSTAGE:int=-10; 
    public function bullet():void {
    addEventListener(Event.ADDED_TO_STAGE,onadd);
    private function onadd(e:Event):void {
    sw=stage.stageWidth;
    sh=stage.stageHeight;
    addEventListener(Event.ENTER_FRAME,loop);
    private function loop(e:Event):void {
    if (y<_OFFSTAGE) {
    removeEventListener(Event.ENTER_FRAME,loop);
    parent.removeChild(this);
    y-=_SPEED;
    }public function removeListeners():void {
    removeEventListener(Event.ENTER_FRAME,loop); 
    And the compiler error I'm getting says this:
    Location:bullet.as line 31 1084: Syntax error: expecting rightbrace before end of program. Source: }
    Location:bullet.as line 31 1084: Syntax error: expecting rightbrace before end of program. Source: }
    And yes it does say it twice. What's going on?
    The vid I'm learning from is this: http://autocad.spinelink.com/adobe-flash-cs4-game-tutorial-shooting.html

    You are missing two closing curly braces at the bottom of the package declaration. You need to close the package itself and the class declaration inside.
    package {
         import flash.display.Sprite;
         import flash.events.Event;
         public class bullet extends Sprite {
              private var sw:Number;
              private var sh:Number;
              private const _SPEED:int=-10;
              private const _OFFSTAGE:int=-10;
              public function bullet():void {
                   addEventListener(Event.ADDED_TO_STAGE,onadd);
              private function onadd(e:Event):void {
                   sw=stage.stageWidth;
                   sh=stage.stageHeight;
                   addEventListener(Event.ENTER_FRAME,loop);
              private function loop(e:Event):void {
                   if (y<_OFFSTAGE) {
                        removeEventListener(Event.ENTER_FRAME,loop);
                        parent.removeChild(this);
                   y-=_SPEED;
              public function removeListeners():void {
                   removeEventListener(Event.ENTER_FRAME,loop);

  • Ending a program on request

    i know how to end a program via the use of System.exit(0); but if i add that just on its own it just closed the program right away, now dont get me wrong i know that will happen, but what i want to know is how would i build that into a loop where if the user selects yes then the program closes and if the user selects no then the program keeps running, i know this will be done with a loop. I just dont know how to build it into a loop, plz help me out the packages im using are: import java.awt.*;
    import hsa.Console;

    > i know how to end a program via the use of
    System.exit(0); but if i add that just on its own it
    t just closed the program right away, now dont get me
    wrong i know that will happen, but what i want to
    know is how would i build that into a loop where if
    the user selects yes then the program closes and if
    the user selects no then the program keeps running, i
    know this will be done with a loop. I just dont know
    how to build it into a loop, plz help me out the
    packages im using are: import java.awt.*;
    import hsa.Console;
    You don't need the awt-package for it.
    Also keep in mind that people don't know what this Console Object is; it's not in the standard java-packages. Here's a small example:
    import hsa.Console;
    public class TestWhileLoop
        static Console c;
        public static void main (String[] args)
            c = new Console();
            String entered = "";
            while(entered.equalsIgnoreCase("q") == false) {
                c.print("Please enter a String (or 'q' to quit): ");
                entered = c.readString();
                c.println("> you entered: "+entered);
            System.exit(0);
    }

  • Line 26 1084:  Syntax Error:  expecting rightbrace before end of program

    Im trying to do an animation, how do I solve Line 26 1084:  Syntax Error:  expecting rightbrace before end of program?
    package
        import flash.display.MovieClip;
        import flash.utils.Timer;
        import flash.events.TimerEvent;
        public class AvoiderGame extends MovieClip
            public var enemy:Enemy;
            public var gameTimer:Timer;
            public function AvoiderGame()
                    enemy = new Enemy();
                    addChild( enemy );
                    gameTimer = new Timer( 25 );
                    gameTimer.addEventListener( TimerEvent.TIMER, moveEnemy );
                    gameTimer.start();
            public function moveEnemy( timerEvent:TimerEvent ):void
               enemy.moveDownABit();

    I have taken your advice but now 2 errors have popped up. Line 16 1137: Incorrect number of arguments . Expected no more than 0. Line 18 1120 : Access of undefined property enemy.
    package
        import flash.display.MovieClip;
        import flash.utils.Timer;
        import flash.events.TimerEvent;
        public class AvoiderGame extends MovieClip
            public var army:Array;
            public var avatar:Avatar;
            public var gameTimer:Timer;
            public function AvoiderGame()
                    army = new Array();
                    var newEnemy = new Enemy( 100, -15 );
                    army.push( newEnemy );
                    addChild( enemy );
                    avatar = new Avatar();
                    addChild( avatar );
                    avatar.x = mouseX;
                    avatar.y = mouseY;
                    gameTimer = new Timer( 25 );
                    gameTimer.addEventListener( TimerEvent.TIMER, onTick );
                    gameTimer.start();
            public function onTick( timerEvent:TimerEvent ):void
                avatar.x = mouseX;
                avatar.y = mouseY;
                for each ( var enemy:Enemy in army )
                         enemy.moveDownABit();
                         if ( avatar.hitTestObject( enemy ) )
                                    gameTimer.stop();

Maybe you are looking for

  • On RAID 10 - How to relieve Log Writer Slow Write Time Trace Files

    We have a DELL 8 CPU 5460 3.16Ghz Xeon with Dell Open Manage RAID 10 array Oracle 10g 10.2.0.4 on RedHat EL 5 with filesystemio_options='' (DEFAULT) disk_asynch_io='TRUE' ( NOT DEFAULT) Running 2 instances 64 bit 10g 10.2.0.4 with an app that does a

  • No tag library could be found with this URI - MyFaces with weblogic 9.2

    I am deploying an application written using MyFaces(JSF1.1) + Tiles in weblogic 9.2. I am getting the following error when I acess any page.. Time[2009-01-28 02:02:33,039] [ACTIVE] ExecuteThread: '9' for queue: 'weblogic.kernel.Default (self-tuning)'

  • Error downloading Master Collection "image not recognized".

    I'm trying to upgrade to the Adobe CS6 Master Collection for my Macbook Pro, but when I download the file from here: Download CS6 products (in English), I get an error that says, "image not recognized", once downloaded and I try to open it. So, how d

  • Not Able to Update my OS.

    I have recently installed Tiger OS on my Mac as I installed a new hard disk. The installation was fine. But I wasnt able to install few important Updats like the one which says, "Mac OS X update Combined (intel)". I am getting an error which says "Yo

  • Will Researchkit also be available in Europe?

    Will Researchkit also be available in Europe or is it already possible to use the apps? I am navigating life with PD an the app for tracking my symptoms would be of great help, even if it would not be possible to participate in the clinical trial bec